PROGRAM DESCRIPTION
RATS! You thought everything was going great in the painting design for Program #2’s small cabin, but as often happens, the user has changed his/her mind! Windows are to be added after all, so now you need less paint and have to buy some windows, instead.
SPECIFIC DIRECTIONS
In Program #2, you calculated the amount of wall & ceiling area to determine how much paint to buy, and you planned to paint the entire surface. Several changes are now needed: a specified number of windows will be planned for; and the ceiling will not be painted—too drab! Since your program will grow, there’s no better time than now to keep the design simple by incorporating functions wherever possible. Your new, improved version will use two functions to keep the logic as logical as possible!
The house specifics: still a simple rectangular structure, but now you’re only concerned with the wall surfaces—the ceiling will be handled elsewhere. You’ll still need to request the length, width, and height of the structure. Do that in main(). But, then, you’ll call two separate functions to calculate most of the details. We want to know what the total wall surface area is, how many windows are allowed/desired, and finally how much paint will be needed.
Use the following functions, by name, in your design for this program.
main: As usual. You may do all input and output in main.
calc_area: Calculate the total surface area of the walls and return the answer to main. (You’ll need
to decide which variable values need to be “sent in” to this function.)
calc_windows: Calculate and return how many windows are recommended for environmental reasons.
Use this rule: a maximum of one window for every 150 square feet of wall surface area.
(Do not recompute the area here—it was already done in calc_area.) (Hint: the answer certainly must be an even number of windows!)
Plan on installing as many windows as possible. For every window, subtract 18 square feet of area, then calculate the final paint requirements as in Program #2: 1 gallon covers 350 square feet.
After computing all the requirements, display the final painting plan for the house: the total wall surface area to be painted; number of windows to be installed; and number of gallons of paint required. In this program you must be realistic about your answers: if, for example, you calculate 4.7 windows, then certainly only 4 windows are allowed; and if you determine that 5.2 gallons of paint are needed, then 6 gallons must be purchased!
Save your program as: prog3-ii.cpp, where the letters “ii” are replaced by your own initials.
Select academic level, specify pages, and choose your desired paper type. Choose the deadline for your order.
To reduce the cost of our essay writing services, select the lengthier deadline.
We can't believe we just said that to you.
Delivering exceptional quality at an affordable price is just the beginning.
We offer 5 advantageous guarantees to ensure a seamless, gratifying, and secure experience.
Our commitment to quality allows us to offer a money-back guarantee, ensuring transparency and your utmost satisfaction.
Read moreEvery paper is crafted from scratch and rigorously scrutinized through advanced plagiarism-detection software, eliminating all possibilities of plagiarism.
Read moreOur free revisions guarantee ensures your satisfaction. We refine your paper until you are entirely content, ensuring peace of mind.
Read moreYour emails security adheres to international data protection regulations, and trustworthy payment systems safeguard your financial details.
Read moreEntrusting us with your funds means acquiring a service backed by expertise. Explore our comprehensive terms and conditions for transparent business interactions.
Read more
Recent Comments