#include <iostream>
using namespace std;
// function prototypes
float get_Pri...
![subject](/tpl/images/cats/mat.png)
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](/tpl/images/cats/User.png)
Answers: 1
Another question on Mathematics
![question](/tpl/images/cats/mat.png)
Mathematics, 20.06.2019 18:04
Any greatly appreciated! you in advance. jody bought 20 shares of amazon at the close price of $121.00. she bought 20 more shares a year later at the price of $127.00. two years later she's sold all of her shares at the price of $133.00. her broker charges $50 for each transaction. after all of these transactions how much money did jody make? a.$65.00b.$5288.00c.$210.00d.$310.00
Answers: 1
![question](/tpl/images/cats/mat.png)
Mathematics, 21.06.2019 20:30
Lola says these two expressions have the same value. expression a expression b which explains whether lola is correct?
Answers: 2
![question](/tpl/images/cats/mat.png)
Mathematics, 21.06.2019 21:00
An airplane travels at an unknown elevation before it descends 3 miles to an elevation of 15 miles. find the elevation of the plane before its descen.
Answers: 1
![question](/tpl/images/cats/mat.png)
Mathematics, 21.06.2019 21:40
Which statement is true about a number and its additive inverse? a. their product is always one. b. their sum is always one. c. they are always reciprocals of each other. d. their sum is always zero.
Answers: 1
You know the right answer?
Questions
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
History, 02.07.2019 10:30
![question](/tpl/images/cats/mat.png)
Mathematics, 02.07.2019 10:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/fizika.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 02.07.2019 10:30
![question](/tpl/images/cats/mat.png)
Mathematics, 02.07.2019 10:30
![question](/tpl/images/cats/mat.png)
Mathematics, 02.07.2019 10:30
![question](/tpl/images/cats/mat.png)
Mathematics, 02.07.2019 10:30
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mkx.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 02.07.2019 10:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/health.png)
![question](/tpl/images/cats/fizika.png)
Physics, 02.07.2019 10:30
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/istoriya.png)
History, 02.07.2019 10:30
![question](/tpl/images/cats/biologiya.png)
Biology, 02.07.2019 10:30