Answer to Question #321308 in C++ for nickname

Question #321308

Write a program with three functions that calculates the final purchase price after various promotions and sales tax are applied. All functions will use Pass by Reference to manipulate the total purchase price. The functions are described below:

 

Function #1 = Take 20% off the price

Function #2 = Take an addition $10 off ONLY if the current total is at least $50 (after function #1)

Function #3 = Apply 7% sales tax to the total after function #2

 

Output:

Enter the total price of your purchases:   [user types: 100]

The final price of your purchase including all promotions and tax is: $74.90



1
Expert's answer
2022-05-04T12:40:11-0400
#include <iostream>
#include <string>
using namespace std;

float price;

void function_1(){
	price = price - 0.2*price;
}
void function_2(){
	if (price > 50)
	   price = price - 0.1*price;
}
void function_3(){
	price = price + 0.07*price;
}

int main(){
	cout << "Enter the total price of your purchases: ";
	cin >> price;
	function_1();
	cout << "The price of your purchase including  - 20%: " << price << endl;
	function_2();
	cout << "The price of your purchase including  - 10% (after -20%): " << price << endl;
	function_3();
	cout << "The final price of your purchase including all promotions and tax is: " << price << endl;

	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog