Answer to Question #246003 in C++ for Yanelisa

Question #246003
Enter item price: 500
Price of item: R500.0
Final price of item: R475.0
Press any key to continue...
Enter item price: 1500
Price of item: R1500.0
Final price of item: R1425.0
Press any key to continue...
Enter item price: 100
Price of item: R100.0
Final price of item: R100.0
1
Expert's answer
2021-10-03T11:45:47-0400
#include <iostream>
#include <iomanip>
using namespace std;




int main(){
	float price;
	float finalPrice=0;
	for(int i=0;i<3;i++){
		cout<<"Enter item price: ";
		cin>>price;
		finalPrice=price;
		if(price>100){
			finalPrice=price-price*0.05;
		}
		cout<<fixed<<"Price of item: R"<<setprecision(2)<<price<<"\n";
		cout<<"Final price of item: R"<<setprecision(2)<<finalPrice<<"\n"; 
		system("pause");
	}


	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
APPROVED BY CLIENTS