#include <iostream>
using namespace std;
// function prototypes
float get_Pri...
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 04.01.2021 15:50 adi47
#include <iostream>
using namespace std;
// function prototypes
float get_Price();
int get_Type();
void tax(float, int);
// start main function
int main() {
float price = 0; // should > 0
int type = 0; // 1 -> Electronic
// 2 -> Sports & Outdoor
// 3 -> Vaccine
price = get_Price;
type = get_type();
cout << "Price before tax = " << price << "\n\n";
tax(price, type);
cout << "Total price after tax = " << price << '\n';
return 0;
}
// start new user-defined functions
void get_Price() {
float p = 0;
while (p < 0) {
cout << "Item price (RM): ";
cin >> p;
}
return p;
}
float get_Type() {
int t == 0;
do {
cout << "\n";
cout << "1 -> Electronic\n";
cout << "2 -> Sports & Outdoor\n";
cout << "3 -> Vaccine\n";
cout << "Item type (1,2,3): ";
cin >> t;
} while (t > 1 || t < 3);
cout << "\n";
return t;
}
// tax is based on item types as follows:
// 1 -> Electronic => 5%
// 2 -> Sports & Outdoor => 3%
// 3 -> Vaccine => 1%
void tax(float p, int t) {
float tax = 0;
switch (t) {
case 1: tax = p * 5 / 100; break;
case 2: tax = p * 3 / 100;
case 3: tax = p * 1 / 100;
}
cout << "Tax cost = " << tax << "\n";
p += tax;
}
What problem?
![ansver](/tpl/images/cats/User.png)
Answers: 1
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 16:20
Octothorpe is another name for what common computer keyboard symbol?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 18:20
What is wi-fi infrastructure? a metropolitan area network that uses radio signals to transmit and receive data a communications technology aimed at providing high-speed wireless data over metropolitan area networks a means by which portable devices can connect wirelessly to a local area network, using access points that send and receive data via radio waves includes the inner workings of a wi-fi service or utility, including the signal transmitters, towers, or poles and additional equipment required to send out a wi-fi signal
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 19:50
Which feature is selected to practice and save the timing of a presentation
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 12:50
What percentage of teens plays video games? a.97% b.100% c.74% d.50%
Answers: 1
You know the right answer?
Questions
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/himiya.png)
Chemistry, 07.05.2020 05:08
![question](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 05:08
![question](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 05:08
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 07.05.2020 05:08
![question](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 05:08
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 07.05.2020 05:08
![question](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 05:08
![question](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 05:08
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 07.05.2020 05:08
![question](/tpl/images/cats/obshestvoznanie.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 07.05.2020 05:08
![question](/tpl/images/cats/himiya.png)
Chemistry, 07.05.2020 05:08