Question
Using C++. I also have to use either input or output with a .txt file. I am going to attach the .txt with this. Thank
Using C++. I also have to use either input or output with a .txt file. I am going to attach the .txt with this. Thank you.
You are to write a program to compute the cost of a lumber order for a local lumber company. The company sells pine, fir, cedar, maple and oak lumber and the lumber is priced by board feet. One board foot equals one square foot, one inch thick. The price per board foot is given in the following table:
Pine 1.05 Fir 1.29 Cedar 2.25 Maple 4.10 Oak 2.40
The lumber is sold in different dimensions (specified in inches for width and height, and feet for length) that need to be converted to board feet. For ex, a 2 x 4 x 8 piece is 2 inches wide, 4 inches high, and 8 feet long, and is equivalent to 5.333 board feet.
The input will be for several customers, each with a lumber order. The lumber order will have several types of woods and different sizes in each order.
Input file: LumberOrder.txt
The input format for an order will be first: a label Customer #: followed by the customers ID number. The next lines contain the lumber order, starting with a letter ( P, F, C, M, O ) corresponding to the five kinds of wood) or a T meaning total. When the letter is a T, there will be no other numbers following the T. The program should print out each entry (itemized the order) and print out the total cost of the order. You must use Functions. One to read the data, one to compute board feet, one to compute cost, one to print a line of output (maybe more output functions.)
Example input:
Customer #: 1020
P 10 2 4 8 Pine 10 pieces 2 inches by 4 inches by 8 feet
M 3 1 6 10 Maple 3 pieces 1 inche by 6 inches by 10 feet
T Flag for the program to print the total cost of this order.
Customer #: 2040
C .. new wood order for next customer.
T
Output;
Customer Order Report Customer # 1020
Pieces Size Wood Cost
10 2x4x8 Pine $47.47
3 1x6x10 Maple $11.25
Total: $1340.28
Customer # 2040
This is the .Txt File I will have to use. Customer #: 1234 M 5 1 8 8 C 10 1 6 12 C 5 1 12 12 P 7 2 4 10 P 6 2 6 12 T Customer #: 3820 P 15 2 4 10 F 20 1 6 16 O 6 1 10 8 P 5 2 8 16 C 2 4 4 12 P 3 1 12 10 T Customer #: 7923 O 8 1 6 10 O 5 2 6 8 O 4 1 8 10 O 2 1 12 10 T Customer #: 2482 C 10 1 8 10 C 8 2 5 16 M 9 4 6 12 F 5 6 6 12 C 2 1 12 16 T Customer #: 7783 F 2 1 4 10 M 8 2 5 10 T Customer #: 4913 P 15 2 4 9 P 20 2 6 24 P 14 2 10 20 P 20 2 4 10 F 1 1 6 10 F 10 2 6 12 T Customer #: 1178 P 25 2 4 10 P 20 2 4 8 P 10 2 4 12 F 20 1 6 16 F 15 1 4 12 O 6 1 10 8 P 5 2 8 16 P 8 2 8 10 C 2 4 4 12 C 2 4 4 8 P 3 1 12 10 T
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started