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 vari

ID: 3759227 • 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 BASESYSTEM = 0;
   int CPU = 1;
   int MONITOR = 2;
   int MEMORY = 3;
   int BLUETOOTH = 4;
   int SPEAKERS = 5;

   float desktopCosts[6] = {500, 350, 250, 200, 50, 99};
   float tabletCosts[6] = {199.99, 0, 99, 99, 50, 59};
   float laptopCosts[6] = {489, 299, 0, 200, 50, 79};

   int option = 0;
   int type = -1;
   double total = 0;
    while(option != -1) {
       cout << "Please tell me about the computer equipment you want!" <<endl;
       cout << "Desktop[0], Tablet[1] or Laptop[2]: " <<endl;
       cin >> type;

       if(type == 0)
           total += desktopCosts[BASESYSTEM];
       else if(type == 1)
           total += tabletCosts[BASESYSTEM];
       if(type == 2)
            total += laptopCosts[BASESYSTEM];


       cout << "Upgrade the CPU[0] or not[1]: " <<endl;

       cin >> option;

       if(type == 0 && option == 0)
           total += desktopCosts[CPU];
       else if(type == 1 && option == 0)
           total += tabletCosts[CPU];
       if(type == 2 && option == 0)
           total += laptopCosts[CPU];

       cout << "Upgrade the monitor[0] or not[1]:" <<endl;

       cin >> option;

       if(type == 0 && option == 0)
           total += desktopCosts[MONITOR];
       else if(type == 1 && option == 0)
           total += tabletCosts[MONITOR];
       if(type == 2 && option == 0)
           total += laptopCosts[MONITOR];

       cout << "Extra memory[0] or not[1]: 1" <<endl;

       cin >> option;

       if(type == 0 && option == 0)
           total += desktopCosts[MEMORY];
       else if(type == 1 && option == 0)
           total += tabletCosts[MEMORY];
       if(type == 2 && option == 0)
           total += laptopCosts[MEMORY];

       cout << "Bluetooth Keyboard[0] or not[1]:" <<endl;
       cin >> option;

       if(type == 0 && option == 0)
           total += desktopCosts[BLUETOOTH];
       else if(type == 1 && option == 0)
           total += tabletCosts[BLUETOOTH];
       if(type == 2 && option == 0)
           total += laptopCosts[BLUETOOTH];


       cout << "Bluetooth Mouse[0] or not[1]: " <<endl;
       cin >> option;

       if(type == 0 && option == 0)
           total += desktopCosts[BLUETOOTH];
       else if(type == 1 && option == 0)
           total += tabletCosts[BLUETOOTH];
       if(type == 2 && option == 0)
           total += laptopCosts[BLUETOOTH];

       cout << "External Speakers[0] or not[1]: " <<endl;
       cin >> option;

       if(type == 0 && option == 0)
           total += desktopCosts[SPEAKERS];
       else if(type == 1 && option == 0)
           total += tabletCosts[SPEAKERS];
       if(type == 2 && option == 0)
           total += laptopCosts[SPEAKERS];

       //ADDING sales tax
       total += (total * 8.25)/100.0;
       cout << "With 8.25% sales tax, your new desktop will cost $"<<total <<endl;
    }
   return 0;
}

---------output--------------

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
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.125
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]:
With 8.25% sales tax, your new desktop will cost $1537.29
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]:
With 8.25% sales tax, your new desktop will cost $2205.36
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]:
With 8.25% sales tax, your new desktop will cost $2928.55
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]:
With 8.25% sales tax, your new desktop will cost $3711.41
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]:
With 8.25% sales tax, your new desktop will cost $4558.85
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]:
With 8.25% sales tax, your new desktop will cost $5476.21
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]:
With 8.25% sales tax, your new desktop will cost $6469.24
Please tell me about the computer equipment you want!
Desktop[0], Tablet[1] or Laptop[2]:
Upgrade the CPU[0] or not[1]:
Upgrade the monitor[0] or not[1]:
Extra memory[0] or not[1]: 1
Bluetooth Keyboard[0] or not[1]:
Bluetooth Mouse[0] or not[1]:
External Speakers[0] or not[1]: