60.6k views
6 votes
#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 << "\\\\";
tax(price, type);
cout << "Total price after tax = " << price << '\\';

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 << "\\";
cout << "1 -> Electronic\\";
cout << "2 -> Sports & Outdoor\\";
cout << "3 -> Vaccine\\";
cout << "Item type (1,2,3): ";
cin >> t;
} while (t > 1 || t < 3);

cout << "\\";
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 << "\\";
p += tax;
}

What problem?​

1 Answer

4 votes

Answer:

10⁶666666666666666666666666

vgggjhhii9

Step-by-step explanation:

uyyyyyyyy6666y6666666666

User Peterretief
by
3.4k points