Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve using c++ Write a program that reads in the original width (y) and length (z) of a sheet of cardboard and prints out

image text in transcribedPlease solve using c++

Write a program that reads in the original width (y) and length (z) of a sheet of cardboard and prints out for every possible integer height (x), the volume of the resulting box and how many square inches of cardboard are wasted by the cutouts. Sample run: Enter sheet width: 101 Enter sheet length: 8 Possible boxes: Height Width Length Volume Waste Area 1 8 6 48 4 2 6 4 48 16 3 4 2 24 3 is the maximum height we can make with a 10x8 sheet. Here is a visual representation of how the functions relate to each other in the final program. Note that some functions will need to be called more than once. main Give prompt Gets user input Give width, length Get max height Give width, length, height Get Volume Give cutoutSize Get waste area getInteger getMax Height getVolume getWastes Give width, length Get Area getArea To detect bad console input and get rid of it until the user enters something useful you need to do something like: int x; cout > x; //if cin reports a failure, start this loop while (cin.fail()) { cin.clear(); //clear any errors so cin starts working cin.ignore (INT_MAX, ' '); //get rid of any existing (bad) input cout > x; //try again cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+18.7. Reconsider Problem 12.12.

Answered: 1 week ago