Desk Problem02

At the end of this set of instructions, is the old instructions for the DeskProblem01. (just in case you forgot)

Take your Desk01 program and save the program under the name Desk02.

Make modifications to this program such that you ask the user if he/she wants to order a desk. If the user enters a ‘y’ (yes), fall into your program,

Ask the user for the information, calculate the cost of the desk, and print out the summary information for the desk.

Then ask the user if he/she wants to order another desk. If yes, go through the process of calculating a desk again

Use the logic in the “readAFile.cpp program I gave you

char orderDesk;

// first read

cout < “want to order a desk? ”;

cin > order Desk;

while(orderDesk == ‘y’)

{

Do your stuff

// second read

cout < “want to order a desk? ”;

cin > order Desk;

}

Calculate the following totals

1.  Number of mahogany desks

2.  Number of oak desks

3.  Number of pine desks

4.  Number of ‘other wood’ desks

5.  Total number of desks

6.  Total costs of all desks

7.  Average costs of the desks

8.  The most expensive desk

9.  The least expensive desk

Your output for totals should look similar to the output below.

I realize that we will not be able to line up some output and have

only two decimal places

*********** wood totals ****************

?? mahogany desks

?? oak desks

?? pine desks

?? other wood desks

*********** desk totals ****************

Total number of desks ??

Total costs of all desks ?????.??

Average costs of the desks ?????.??

The most expensive desk ?????.??

The least expensive desk ?????.??

The output for each customer has been changed from Desk01. The output should look like the following

1 Customer name ?????????????

2 desk length ???.??

3 desk width ???.??

4 number of drawers ??

5 wood type mahogany [or Oak or pine]

6

7 cost estimate

8 $200.00 base cost

9 50.00 surface area greater than 750 square inches

10 ??.?? cost of drawers ($30.00 per drawer)

11 150.00 mahogany

Or

125.00 oak

Or

100.00 pine

12 ------

13 $???.?? Total cost

Note: you must have lines 1~3 (name length and width)

you will have line 4 if there are any drawers requested

you will have line 5 if a wood type has been selected

if wood code is an ‘m’ wood type mahogany

if wood code is an ‘o’ wood type oak

if wood code is an ‘p’ wood type pine

line 06 is a blank line

line 07 is required

line 08 is required

line 09 required if the surface area is greater than 750 square inches

line 10 required if there are drawers

line 11 is required if a valid wood type is selected (m, o, or p)

line 12 is required

line 13 is required

Old instructions

Create a C that will ask the user for information regarding a desk to be made and calculate the cost of the desk

REQUIREMENTS:

1.  ask the user for each of these fields (in this order)

customer name String

length of desk double or float

width of desk double or float

number of drawers int

wood type char

m = mahogany

o = oak

p = pine

2. note: to read in the customer name…..

a. declare the following 2 character arrays

char lastName [80];

char firstName[80];

b.  to read in the names……

cout < “enter your first name: “;

cin > firstName;

cout < “enter your last name; “;

cin > lastName;

c.  to print out the customer name line

cout < “Customer Name “ < firstName < “ “ < lastName < “\n”;

2. calculations

a. base cost of desk is $200.00

b. if surface (length X width) of the desk is over 750 sq. in.

add $50.00

c. for every drawer, add $30.00

d. if wood type is

m = mahogany add $150.00

o = oak add $125.00

p = pine add $100.00

any other code no extra cost

3. your output should look like the example below should be the customer name and the cost of the desk