I am having trouble with an exercise where I have to write aprogram. This is wha
ID: 3617551 • Letter: I
Question
I am having trouble with an exercise where I have to write aprogram. This is what the exercise says: You're working for a lumber company, and your employer wouldlike a program that calculates the cost of lumber for an order. Thecompany sells pine, fir, cedar, maple, and oak lumber. Luber ispriced by board feet. One board foor equals one square foot, oneinch thick. The price per board foot is given in the followingtable: Pine 0.89 Fir 1.09 Cedar 2.26 Maple 4.50 Oak 3.10 The lumber is sold in different dimensions (specified ininches of width and height, and feet of length) that need to beconverted to baord feet. For example, a 2 x 4 x 8 piece is 2 incheswide, 4 inches high, and 8 feet long, and is equivalent to 5.333board feet. An entry from the user will be in the form of a letterand four integer numbers. The integers are the number of pieces,width, height, and length. The letter will be one of P, F, C, M, O(corresponding to the five kinds of wood) or T, meaning total. Whenthe letter is T, there are no integers following it on the line.The program should print out the price for each entry, and printthe total after T is entered. Here is an example run: Enter item: P 102 4 8 10 2x4x8 Pine, cost: $47.47 Enter item: M 1 1 128 1 1x12x8 Maple, cost : $36.00 Enter item: T Total cost: $83.47 develop the program using functional decomposition, and useproper style and documentation in your code. Your program shouldmake appropriate use of value-returning functions in solving thisproblem. Be sure that the user prompts are clear, and that theoutput is labeled appropriately. I am having trouble with an exercise where I have to write aprogram. This is what the exercise says: You're working for a lumber company, and your employer wouldlike a program that calculates the cost of lumber for an order. Thecompany sells pine, fir, cedar, maple, and oak lumber. Luber ispriced by board feet. One board foor equals one square foot, oneinch thick. The price per board foot is given in the followingtable: Pine 0.89 Fir 1.09 Cedar 2.26 Maple 4.50 Oak 3.10 The lumber is sold in different dimensions (specified ininches of width and height, and feet of length) that need to beconverted to baord feet. For example, a 2 x 4 x 8 piece is 2 incheswide, 4 inches high, and 8 feet long, and is equivalent to 5.333board feet. An entry from the user will be in the form of a letterand four integer numbers. The integers are the number of pieces,width, height, and length. The letter will be one of P, F, C, M, O(corresponding to the five kinds of wood) or T, meaning total. Whenthe letter is T, there are no integers following it on the line.The program should print out the price for each entry, and printthe total after T is entered. Here is an example run: Enter item: P 102 4 8 10 2x4x8 Pine, cost: $47.47 Enter item: M 1 1 128 1 1x12x8 Maple, cost : $36.00 Enter item: T Total cost: $83.47 develop the program using functional decomposition, and useproper style and documentation in your code. Your program shouldmake appropriate use of value-returning functions in solving thisproblem. Be sure that the user prompts are clear, and that theoutput is labeled appropriately. Total cost: $83.47 develop the program using functional decomposition, and useproper style and documentation in your code. Your program shouldmake appropriate use of value-returning functions in solving thisproblem. Be sure that the user prompts are clear, and that theoutput is labeled appropriately.Explanation / Answer
please rate - thanks #include #include using namespace std; void getinfo(char, double&, string &); double input(); double finish(double,double,string); int main() {double total=0,feet,cost; cout.setf(ios::fixed,ios::floatfield); cout.precision(2); char type; string wood; couttype; while(type!='T') {feet=input(); getinfo(type,cost,wood); total+=finish(cost,feet,wood); couttype; } coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.