subject
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
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Awide variety of “ apps “ are available to customize devices. which category of app does the word processing software fall into?
Answers: 2
question
Computers and Technology, 23.06.2019 01:00
Let r be a robotic arm with a fixed base and seven links. the last joint of r is a prismatic joint, the other ones are revolute joints. give a set of parameters that determines a placement of r. what is the dimension of the configuration space resulting from your choice of parameters?
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
Column a of irma’s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
You know the right answer?
#include <iostream> using namespace std;

// function prototypes
float get_Pri...
Questions
question
Mathematics, 03.12.2021 03:50
question
Mathematics, 03.12.2021 03:50