subject
Mathematics, 04.01.2021 15:50 neonaandrews10

#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's problem?

ansver
Answers: 1

Another question on Mathematics

question
Mathematics, 21.06.2019 16:30
Triangle inequality theorem state if each set of three numbers can be the lengths of the sides of a triangle. 1. 9, 8, 22. 2. 5,10,12. 3. 7,10,22. 4. 4,11,12. 5. 11,9,10. 6. 10,4,19. 7. 3,12,10. 8. 4,3,2. 9. 6,5,13. 10. 7,12,20. me .
Answers: 3
question
Mathematics, 21.06.2019 18:00
The price of an item has been reduced by 30%. the original price was $30. what is the price of the item now ?
Answers: 1
question
Mathematics, 21.06.2019 19:10
How many solutions does the nonlinear system of equations graphed below have?
Answers: 2
question
Mathematics, 21.06.2019 20:00
What effect would doubling all the dimensions of a triangular pyramid have on the volume of the pyramid? explain your reasoning.
Answers: 1
You know the right answer?
#include <iostream> using namespace std;

// function prototypes
float get_Pri...
Questions
question
Spanish, 01.04.2020 21:36
Questions on the website: 13722359