Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Desktop Computer Costs Tablet Computer Costs Laptop Computer Costs Base System: $500.00 Base System: $199.99 Base System: $489.00 Upgraded CPU, if requested: extra $350.00 Upgraded CPU, if requested: extra $99.00 Upgraded CPU, if requested: extra $299.00 Upgraded Monitor, if requested: extra $250.00 Extra Memory, if requested: extra $200.00 Extra Memory, if requested: extra $99.00 Extra Memory, if requested: extra $200.00 Bluetooth Keyboard or Mouse: extra $50.00 each Bluetooth Keyboard or Mouse: extra $50.00 each Bluetooth Keyboard or Mouse: extra $50.00 each External Speakers, if requested: extra $99.00 External Speakers, if requested: extra $59.00 External Speakers, if requested: extra $79.00

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;
}