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

You\'ve been hired by a local lumberyard to help computerize itsoperations. Your

ID: 3608528 • Letter: Y

Question

You've been hired by a local lumberyard to help computerize itsoperations. Your first assignment is to write a program thatcomputes the total amount of an item ordered in standard units,given its type, dimensions, and the number of pieces ordered. The yard sells two kinds of items: boards and plywood panels. First, the program should read a letter - either 'B' for board or'P' for plywood - to determine the type. Next it should readfour integer numbers.

For boards, the first two numbers are the width and the depth ininches; the third number is the length in feet; and the fourthnumber is the number of pieces ordered. To compute thequantity ordered, you have to calculate the total volumeordered. The unit for board volume is board foot, which isequivalent to 1 square foot of lumber, 1 inch think, or 144 cubicinches. For example, given 14 pieces of 2-inch by 4-inchlumber, each 8 feet long, the quantity ordered is 74.67 boardfeet. To determine the board feet, we use this formula:

(2 in. x 4 in. x (8 ft. x 12 in./ft) x 14 pieces)/144 cubic in.per board foot

For plywood, the first two numbers are the thickness of thesheet, expressed as a fraction; the third number is the length ofthe sheet in feet, and the last number is the number of sheetsordered. The lumberyard only stocks plywood in sheets in4-foot widths, so there's no need to enter the width. At thislumberyard, the unit for plywood volume is a full sheet. Afull sheet is 4 feet (48 inches) wide, 8 feet (96 inches) long, and1 inch thick, or 4608 cubic inches. Given 18 sheets of3/4-inch-thick plywood, 8 feet long (and 4 feet wide), the quantityordered is 13.5 full sheets. We use this formula:

(18 sheets x 3/4 in. x (8 ft x 12 in./ft) x 48 in.)/4608 cubicin. per sheet

Finally, you must display a comment based on the amount oflumber ordered telling the customer what they've earned in thelumberyard's Buyer's Rewards Program. Display the followingcomments given the amount of lumber ordered.

For boards:

For panels:

Develop the lumberyard program. Irecommend you develop the code incrementally, that is, get one partworking before moving on to the next. Add the code fordisplaying a comment only after you are sure the rest of yourprogram is working correctly.

You do not need to check for incorrectuser input. Assume the user will correctly enter a 'B' or 'P'when queried for the lumber type.

You do need to guard against a divide-by-zeroerror. That is, if the user enters a 0 for the divisor partof the plywood thickness, set the amount of plywood to zero. Do not run the equation.

Be sure to display the correct prompts given thetype of lumber selected. See below!

Be sure to test all possible paths through yourcode.

Two different example runs appears below(user input shown underlined):

Would youlike to order boards or panels (B or P)? B

Width (ininches): 2

Depth (ininches): 4

Length (infeet): 8

Quantity:14

Quantityordered is 74.67 board feet.

You've earned a free 'Lumberjacks Are Cool'sticker.

Would youlike to order boards or panels (B or P)? P

Numerator ofthickness: 3

Denominatorof thickness: 4

Length (infeet): 8

Quantity:18

Quantityordered is 13.5 full sheets.

You've earned a free Tahoe Joe's steakdinner.

Explanation / Answer

please rate - thanks #include #include int main() {char type; int width,depth,length,quantity,num,den; double amount; printf("Would you like to order boards or panels (B or P)? "); type= getchar(); while (getchar() != ' '); if(type=='B')    {printf("Width (in inches): ");     scanf("%d",&width);     printf("Depth (in inches): ");     scanf("%d",&depth);     printf("Length (in feet): ");     scanf("%d",&length);     printf("Quantity: ");     scanf("%d",&quantity);    amount=(width*depth*(length*12.)*quantity)/144;     printf("Quantity ordered is %.2lf board feet.",amount);     printf(" You've earned a free ");     if(amount>500)        printf("chain saw. ");     else        if(amount>100)           printf("Tahoe Joe's steak dinner. ");        else           printf("'Lumberjacks Are Cool' sticker. ");    } else     {printf("Numerator of thickness: ");      scanf("%d",&num);      printf("Width (in inches): ");      scanf("%d",&den);      printf("Width (in inches): ");      scanf("%d",&length);      printf("Width (in inches): ");      scanf("%d",&quantity);     amount=(quantity*((double)num/den)*(length*12)*48)/4608;      printf("Quantity ordered is %.2lf fullsheets. ",amount);      printf(" You've earned a free ");      if(amount>50)        printf("chain saw. ");      else        if(amount>10)           printf("Tahoe Joe's steak dinner. ");        else           printf("'Lumberjacks Are Cool' sticker. ");      }     getch(); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote