Answer to Question #235207 in C++ for joji

Question #235207

"Write a C++ application which performs the following scenarios:

i.          List of available book items as given below and prompt the user to select any SEVEN (7) choices:

1-Story Book, 2-Documentary Book, 3-Cookery Book, 4-Magazine, 5-Religious, 6-Journals, 7-Stop

ii.           Display error message if the user enters choices other than 1 to 7.

iii.          For menu 2, and 5, there will be NO discount given, but for menu 1, 3, and 6, there will be a 5% discount given, where by for menu 4, there will be a 10% discount given.

iv.         Calculate the Overall price, discount, Sales Tax (2%), and final Total and display the receipt along with customer details. [receipt must be interactive and which contains all the details]."


My question is, how do I add a few items to the shopping cart?


1
Expert's answer
2021-09-09T17:13:12-0400
#include<iostream>
using namespace std;


int main(){
	int choice;
	double overall_price, discount, salesTax ,  final_Total;
	cout<<"Select any 7 choices\n";
	cout<<"1-Story Book\n 2-Documentary Book\n3-Cookery Book\n4-Magazine\n5-Religious\n6-Journals\n7-Stop\n";
	cin>>choice;
	if(choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6 && choice != 7){
		cout<<"Invalid choice selected\n";
	}
	else{
		if(choice == 2 || choice==5 ){
			overall_price = 1000;
			
			discount = 0;
		}
		else if(choice == 1 || choice == 3 || choice == 6){
			overall_price  = 2000;
			discount = overall_price * 0.05;
		
		}
		else if(choice == 4){
			overall_price  = 500;
			discount = overall_price * 0.1;
			
		}
		else if(choice == 7){
			exit(0);
		}
		salesTax = overall_price * 0.02;
		final_Total = overall_price - (discount + salesTax);
		cout<<"Customer  Receipt\n ";
		cout<<"Overal price:  "<<overall_price<<endl;
		cout<<"Discount:  "<<discount<<endl;
		cout<<" Sales Tax (2%)  "<<salesTax<<endl;
		cout<<"Final Total:  "<<final_Total<<endl;
		
	}
}

You can use arrays or linked lists to add items to the shopping cart.


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