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 15:30
Find the slope of the line below . enter your answer as a fraction or decimal. use a slash mark ( / ) as the fraction bar if necessary
Answers: 3
question
Mathematics, 21.06.2019 17:00
Omar is going on a road trip! the car rental company offers him two types of cars. each car has a fixed price, but he also needs to consider the cost of fuel. the first car costs $90 to rent, and because of its fuel consumption rate, there's an additional cost of s0.50 per kilometer driven.
Answers: 2
question
Mathematics, 21.06.2019 18:30
For this option, you will work individually. the pythagorean theorem can be used in many real-world scenarios. part 1 write your own real-world scenario where the pythagorean theorem can be applied to find a missing piece. you may choose to write a problem that is two- or three-dimensional in nature. be sure that you will be able to draw a diagram of your scenario. write out your problem and submit it for part 1. be sure to end your scenario with a question. part 2 draw a diagram of the scenario you created in part 1. you may draw by hand and scan and upload your drawing or create a computer-generated drawing for submission. be sure to label all parts and dimensions of the drawing. part 3 solve the question that you posed in part 1. show all of your steps in answering the question. for this option, you will need to submit all three parts for full credit—your real-world problem and question, the diagram that you created, and your work solving the problem, showing all steps. * note that your instructor is looking for your own original idea. while it is acceptable to use the internet for research and inspiration, academic integrity policies apply.
Answers: 1
question
Mathematics, 21.06.2019 20:30
10 points? me . its important ‼️‼️
Answers: 1
You know the right answer?
#include <iostream> using namespace std;

// function prototypes
float get_Pri...
Questions
Questions on the website: 13722361