Question

In: Computer Science

A PC store sells many types of computers. The PC can have either 16 or 8...

A PC store sells many types of computers. The PC can have either 16 or 8 gigabytes of memory.

The quality of the PCs can be either New, Refurbished, or Dented.

The price list is given as follows:

Memory size/Status New Refurbished Dented

16 gigabytes 849.99 729.99 609.99

8 gigabytes 699.99 579.99 439.99


Determine the price of a given PC dependent on the user inputs. The sale tax is 9.25% for each PC.

User input can only be 8 or 16 for memory size and 'N', 'R', or 'D' for quality (upper-case). The input quantityt should be 0 or positive.

If any user input is not correct, display an error message and skip all calculation.

All currency amount should be displayed with 2 digits in decimal fraction.


Here are several separate program sample runs. There is No need to use loop for repetition.

Enter the memory size of the PC (8 or 16 gigabytes): 16

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): N

Enter PC quantity want to buy: 2

The item price is $1699.98

The sale tax is $157.25

The total bill is $1,857.23

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 8

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): R

Enter PC quantity want to buy: 3

The item price is $1739.97

The sale tax is $160.95

The total bill is $1900.92

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 15

Invalid memory size!

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 8

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): A

Invalid PC quality!

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 8

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): (user hit Tab key)

Invalid PC quality!


----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 16

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): R

Enter PC quantity want to buy: -2

Invalid PC quantity!

[C++ PROGRAMING]

Solutions

Expert Solution

SOURCE CODE IN C++:

#include <iostream>

#include <stdio.h>

using namespace std;

int main()

{

int size;

cout << "Enter the memory size of the PC (8 or 16 gigabytes): "; //input prompt

cin >> size; //input

if(size!=8 && size!=16) //input validation

{

cout << "Invalid memory size!" << endl; //error message

return 1; //terminating program

}

char quality;

cout << "Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): "; //input prompt

cin >> quality; //input

if(quality!='N' && quality!='R' && quality!='D') //input validation

{

cout << "Invalid PC quality!" << endl; //error message

return 1; //terminating program

}

int quantity;

cout << "Enter PC quantity want to buy: "; //input prompt

cin >> quantity; //input

if(quantity<0) //input validation

{

cout << "Invalid PC quantity!" << endl; //error message

return 1; //terminating program

}

//determining price for user input

double price;

if(size==16)

{

if(quality=='N')

price=849.99;

else if(quality=='R')

price=729.99;

else

price=609.99;

}

else

{

if(quality=='N')

price=699.99;

else if(quality=='R')

price=579.99;

else

price=439.99;

}

//calculating total price and sales tax and then total bill

price*=quantity;

double sales_tax=0.0925*price;

double total=price+sales_tax;

//output

printf("The item price is $%.2f\n",price);

printf("The sales tax is $%.2f\n",sales_tax);

printf("The total bill is $%.2f\n",total);

return 0;

}

OUTPUT:


Related Solutions

Savemore store is a retail store that sells many different types of items and many different...
Savemore store is a retail store that sells many different types of items and many different brands. The store has plain clothes security workers who walk around the store and watch customers to monitor and limit theft of merchandise. Charley Customer enters Savemore and is seen walking down the clothing aisles looking at different clothing for sale at the store. Charley Customer has a shopping cart with him and makes his way to the registers to pay for the items...
An electronics firm manufactures two types of personal computers (PC), a desktop model and a laptop...
An electronics firm manufactures two types of personal computers (PC), a desktop model and a laptop model. The production of a desktop computer requires a capital expenditure of $400 and 40 hours of labor. The production of a laptop computer requires a capital expenditure of $250 and 30 hours of labor. The firm has $20,000 capital and 2,160 labor-hours available for production of desktop and laptop computers. Each desktop computer contributes a profit of $320 and each laptop computer contributes...
PC-Express is a computer retail store that sells desktops and laptops. The company earns $600 on...
PC-Express is a computer retail store that sells desktops and laptops. The company earns $600 on each desktop computer it sells and $900 on each laptop. The computers PCExpress sells are actually manufactured by another company. This manufacturer has a special order to fill for another customer and cannot ship more than 80 desktops and 75 laptops to PC-Express next month. The employees at PC-Express must spend about 2 hours installing software and checking each desktop computer the company sells....
An offline retail store called CoolStore have customers that are either students or not. Customers can...
An offline retail store called CoolStore have customers that are either students or not. Customers can buy a plastic bag or not. We know for a fact that: Twenty-five percent of all customers are students. Among customers that are students, eighty percent buy a plastic bag. Among customers who buy a plastic bag, fifty percent are students. Forty customers are chosen at random. The probability is one percent that the number of customers buying a plastic bag exceeds what number?
Applying the Central Limit Theorem, suppose that personal computers (PC) have a mean of weight of...
Applying the Central Limit Theorem, suppose that personal computers (PC) have a mean of weight of 7.5 pounds with a standard deviation of 1.1 pounds. If you take a sample of the weight of 50 different brands of PC, the sample standard deviation is: Select one: a. 7.5 1.1 7.51.1 b. 1.1 50 √ 1.150 c. 7.5+1.1 7.5+1.1
A store sells about 360 calculators peryear. It would cost the store $8 to store one...
A store sells about 360 calculators peryear. It would cost the store $8 to store one calculator for the whole year. On the other hand, it costs $10 each time the store reorders the calculators, plus $8for each calculator. How many times per year should the store reorderthe calculators and how many at a time to minimize inventory costs?
Debra can make either 12 cakes or 16 cookies in 4 hours. Sam can make either...
Debra can make either 12 cakes or 16 cookies in 4 hours. Sam can make either 6 cakes or 12 cookies in 4 hours. a. Who has an absolute advantage at producing cakes and who has an absolute advantage at producing cookies? Briefly explain your answers. b. State Debra’s and Sam’s opportunity costs of producing one cake and one cookie. Draw and place your answer in a table. c. If both Debra and Sam concentrate on producing only the product...
The Fashion Store sells fashion items. The store has to order these items many months in...
The Fashion Store sells fashion items. The store has to order these items many months in advance of the fashion season in order to get a good price on the items. Each unit costs Fashion $100. These units are sold to customers at a price of $250 per unit. Items not sold during the season can be sold to the outlet store at $80 per unit. If the store runs out of an item during the season it has to...
An online backpack store sells many products that are popular with elementary school children. The store...
An online backpack store sells many products that are popular with elementary school children. The store knows some children under 10 subscribe to the store's coupon service. Is the store subject to the Children's Online Privacy Act?
ComputerGeeks. com is a retail store that sells computers, laptops, supplies, and other electronic devices. The...
ComputerGeeks. com is a retail store that sells computers, laptops, supplies, and other electronic devices. The adjusted account data is given below from the year ended December 31, 2019 Accounts Payable 14,140 Accounts Receivable 19,250 Accumulated Depreciation - Building 13,000 Accumulated Depreciation - Delivery Equipment 3,600 Accumulated Depreciation - Office Equipment 2,500 Accumulated Depreciation - Warehouse Equipment 2,300 Allowance for Doubtful Accounts 2,250 Bruce Zaro, Capital 60,940 Bruce Zaro, Drawing 24,000 Building 48,500 Cash 12,200 Delivery Equipment 16,400 Delivery Wages...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT