Write a program that asks the user to enter the material they wish to purchase (wood, brick, or metal). Then ask the user to enter the number of material they wish to buy. Display the cost of each material, the shipping charge, and the total cost (cost of materials + shipping charge). If the user enters an invalid material or invalid number, display an error message.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
O Instructions
Homedepot sells wood, brick, and metal using the following table:
Number of
Wood
Price Per
Shipping
Charge
Wood
1 - 100
10.00
10.00
101 - 500
8.00
25.00
501 +
5.00
50.00
Number of
Brick
Price Per
Shipping
Brick
Charge
1 - 100
1.00
20.00
101 - 500
0.75
30.00
501 +
0.50
40.00
Number of
Price Per
Shipping
Charge
Metal
Metal
1 - 100
8.00
15.00
101 500
7.00
30.00
501 +
5.00
50.00
Write a program that asks the user to enter the material they wish to purchase (wood,
brick, or metal). Then ask the user to enter the number of material they wish to buy.
Display the cost of each material, the shipping charge, and the total cost (cost of materials
+ shipping charge). If the user enters an invalid material or invalid number, display an error
message.
Sample Run 1
Enter the material: metal-
Enter the number.of units::700-
Cost per metal::5.00-
Shipping cost: 50.00-
Total·cost: :3550.00-
Transcribed Image Text:O Instructions Homedepot sells wood, brick, and metal using the following table: Number of Wood Price Per Shipping Charge Wood 1 - 100 10.00 10.00 101 - 500 8.00 25.00 501 + 5.00 50.00 Number of Brick Price Per Shipping Brick Charge 1 - 100 1.00 20.00 101 - 500 0.75 30.00 501 + 0.50 40.00 Number of Price Per Shipping Charge Metal Metal 1 - 100 8.00 15.00 101 500 7.00 30.00 501 + 5.00 50.00 Write a program that asks the user to enter the material they wish to purchase (wood, brick, or metal). Then ask the user to enter the number of material they wish to buy. Display the cost of each material, the shipping charge, and the total cost (cost of materials + shipping charge). If the user enters an invalid material or invalid number, display an error message. Sample Run 1 Enter the material: metal- Enter the number.of units::700- Cost per metal::5.00- Shipping cost: 50.00- Total·cost: :3550.00-
Sample Run 1
Enter the material: metal-
Enter the number.of units::700-
Cost per metal: 5.00-
Shipping cost: 50.00-
Total cost::3550.00-
Sample Run 2
Enter the material: bricke
Enter the number.of units::10-
Cost per metal: 1.00-
Shipping cost: 20.00-
Total cost::30.00-
Sample Run 3
Enter the material: paint-
Enter the number.of units::100-
Error-
Sample Run 4
Enter the material: wood-
Enter the number.of units:-23-
Error-
Additional Notes: Regarding your code's standard output, CodeLab will check for case errors and
will check whitespace (tabs, spaces, newlines) exactly.
O Interactive Session ?
O Visible newlines
O Visible whitespace
O Display stdin
O Display stdout
wood
278
Cost per wood: 8.00
Shipping cost: 25.00
Total cost: 2249.00
Transcribed Image Text:Sample Run 1 Enter the material: metal- Enter the number.of units::700- Cost per metal: 5.00- Shipping cost: 50.00- Total cost::3550.00- Sample Run 2 Enter the material: bricke Enter the number.of units::10- Cost per metal: 1.00- Shipping cost: 20.00- Total cost::30.00- Sample Run 3 Enter the material: paint- Enter the number.of units::100- Error- Sample Run 4 Enter the material: wood- Enter the number.of units:-23- Error- Additional Notes: Regarding your code's standard output, CodeLab will check for case errors and will check whitespace (tabs, spaces, newlines) exactly. O Interactive Session ? O Visible newlines O Visible whitespace O Display stdin O Display stdout wood 278 Cost per wood: 8.00 Shipping cost: 25.00 Total cost: 2249.00
Expert Solution
steps

Step by step

Solved in 6 steps with 9 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY