Project 1: Computers-R-Us! Create a C++ program which calculates the cost of var
ID: 673027 • Letter: P
Question
Project 1: Computers-R-Us!
Create a C++ program which calculates the cost of various computer electronic equipment purchases from the new online store, Computers-R-US. IN ORDER TO RECEIVE FULL CREDIT, YOU MUST CREATE AND CALL FUNCTIONS WITH PARAMETERS TO SOLVE THIS PROBLEM.
Summarized in the chart below is the cost calculations I want your program to perform. Be sure to add 8.25% sales tax to your final calculated cost.
COMPUTERS-R-US ELECTRONICS COSTS
COMPUTERS-R-US COST CALCULATOR
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]: 0
Upgrade the CPU[0] or not[1]: 0
Upgrade the monitor[0] or not[1]: 1
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]: 1
Bluetooth Mouse[0] or not[1]: 1
External Speakers[0] or not[1]: 1
With 8.25% sales tax, your new desktop will cost $920.13
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]: 1
Upgrade the CPU[0] or not[1]: 0
Extra memory[0] or not[1]: 0
Bluetooth Keyboard[0] or not[1]: 0
Bluetooth Mouse[0] or not[1]: 0
External Speakers[0] or not[1]: 1
With 8.25% sales tax, your new tablet will cost $539.07
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]: 2
Upgrade the CPU[0] or not[1]: 0
Extra memory[0] or not[1]: 0
Bluetooth Keyboard[0] or not[1]: 1
Bluetooth Mouse[0] or not[1]: 1
External Speakers[0] or not[1]: 1
With 8.25% sales tax, your new laptop will cost $1069.51
Explanation / Answer
#include<iostream>
using namespace std;
int main(){
int choice,flag;
double amount = 0;
cout<<"Please tell me about the computer equipment you want! Desktop[0], Tablet[1] or Laptop[2]:";
cin>>choice;
switch(choice){
case 0:
amount += 500;
cout<<"Upgrade the CPU[0] or not[1]:";
cin>>flag;
amount += flag*350;
cout<<"Upgrade the monitor[0] or not[1]:";
cin>>flag;
amount += flag*250;
cout<<"Extra memory[0] or not[1]:";
cin>>flag;
amount += flag*200;
cout<<"Bluetooth Keyboard[0] or not[1]:";
cin>>flag;
amount += flag*50;
cout<<"Bluetooth Mouse[0] or not[1]:";
cin>>flag;
amount += flag*50;
cout<<"External Speakers[0] or not[1]:";
cin>>flag;
amount += flag*99;
break;
case 1:
amount += 199.99;
cout<<"Upgrade the CPU[0] or not[1]:";
cin>>flag;
amount += flag*99;
cout<<"Extra memory[0] or not[1]:";
cin>>flag;
amount += flag*99;
cout<<"Bluetooth Keyboard[0] or not[1]:";
cin>>flag;
amount += flag*50;
cout<<"Bluetooth Mouse[0] or not[1]:";
cin>>flag;
amount += flag*50;
cout<<"External Speakers[0] or not[1]:";
cin>>flag;
amount += flag*59;
break;
case 2:
amount += 489;
cout<<"Upgrade the CPU[0] or not[1]:";
cin>>flag;
amount += flag*299;
cout<<"Extra memory[0] or not[1]:";
cin>>flag;
amount += flag*200;
cout<<"Bluetooth Keyboard[0] or not[1]:";
cin>>flag;
amount += flag*50;
cout<<"Bluetooth Mouse[0] or not[1]:";
cin>>flag;
amount += flag*50;
cout<<"External Speakers[0] or not[1]:";
cin>>flag;
amount += flag*79;
break;
}
cout<<"With 8.5% sales tax, your desktop will cost $"<<amount + 0.085*amount;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.