You are working for a lumber company, and your employer would like a program that calculates the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet. One board foot equals one square foot that is one inch thick. The price per board foot is given in the following table: Pine 0.89 Fir 1.09 Cedar 2.26 Maple 4.50 Oak 3.10 The lumber is sold in different dimensions (specified in inches of width and height, and feet of length) that need to be converted to board feet. For example, 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 (2 * 4 * 8 = 64, which when divided by 12 = 5.333 board feet). An entry from the user will be in the form of a letter and 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. When the letter is T, there are no integers following it on the line. The program should print out the price for each entry, and print the total after T is entered. Here is an example run: Enter item: P 10 2 4 8 10 2x4x8 Pine, cost: $47.47 Enter item: M 1 1 12 8 1 1x12x8 Maple, cost: $36. 00 Enter item: T Total cost: $83.47 Develop the program using functional decomposition, and use proper style and documentation in your code. Your program must make appropriate use of value-returning functions in solving this problem. Make sure that the user prompts are clear and that the output is labeled appropriately.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Can I get help writing this program in c++

**Lumber Cost Calculation Program**

You are working for a lumber company, and your employer needs a program to calculate the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet, with one board foot equaling one square foot that is one inch thick. The price per board foot is given in the following table:

- Pine: $0.89
- Fir: $1.09
- Cedar: $2.26
- Maple: $4.50
- Oak: $3.10

**Conversion to Board Feet**

Lumber is sold in different dimensions (specified in inches of width and height, and feet of length) that must be converted to board feet. For instance, a 2x4x8 piece is 2 inches wide, 4 inches high, and 8 feet long, equivalent to 5.333 board feet:

\[
\text{Board feet} = \frac{2 \times 4 \times 8}{12} = 5.333
\]

**User Input Format**

An entry from the user consists of a letter and four integer numbers:

- The letter indicates the type of wood: 
  - P (Pine)
  - F (Fir)
  - C (Cedar)
  - M (Maple)
  - O (Oak)
- T indicates the total, with no numbers after T.
  
The integers are: 
- Number of pieces
- Width
- Height
- Length

The program should output the price for each entry and print the total after T is entered.

**Example Run:**

```
Enter item: P 10 2 4 8
10 2x4x8 Pine, cost: $47.47
Enter item: M 1 1 12 8
1 1x12x8 Maple, cost: $36.00
Enter item: T
Total cost: $83.47
```

**Program Requirements**

Develop the program using functional decomposition and document your code properly. Ensure the program uses value-returning functions effectively and that user prompts are clear, with appropriately labeled output.
Transcribed Image Text:**Lumber Cost Calculation Program** You are working for a lumber company, and your employer needs a program to calculate the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet, with one board foot equaling one square foot that is one inch thick. The price per board foot is given in the following table: - Pine: $0.89 - Fir: $1.09 - Cedar: $2.26 - Maple: $4.50 - Oak: $3.10 **Conversion to Board Feet** Lumber is sold in different dimensions (specified in inches of width and height, and feet of length) that must be converted to board feet. For instance, a 2x4x8 piece is 2 inches wide, 4 inches high, and 8 feet long, equivalent to 5.333 board feet: \[ \text{Board feet} = \frac{2 \times 4 \times 8}{12} = 5.333 \] **User Input Format** An entry from the user consists of a letter and four integer numbers: - The letter indicates the type of wood: - P (Pine) - F (Fir) - C (Cedar) - M (Maple) - O (Oak) - T indicates the total, with no numbers after T. The integers are: - Number of pieces - Width - Height - Length The program should output the price for each entry and print the total after T is entered. **Example Run:** ``` Enter item: P 10 2 4 8 10 2x4x8 Pine, cost: $47.47 Enter item: M 1 1 12 8 1 1x12x8 Maple, cost: $36.00 Enter item: T Total cost: $83.47 ``` **Program Requirements** Develop the program using functional decomposition and document your code properly. Ensure the program uses value-returning functions effectively and that user prompts are clear, with appropriately labeled output.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education