Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Just need to get the coding for the console. Each variable used in your program needs a comment describing its purpose. Remember to create named

Just need to get the coding for the console.

image text in transcribed

image text in transcribed

Each variable used in your program needs a comment describing its purpose. Remember to create named constants instead of using magic numbers. Here, you'll want to avoid using the numbers 15, 20, and 375. Instead create named constants to represent the square feet per door, square feet per window, and square feet per gallon of paint. These requirements are expected for every program and are listed in the syllabus. Preconditions and postconditions are not expected yet

Create an interactive Windows Console (Chapter 2) or Windows Forms (Chapter 3) application that will calculate the number of gallons of paint needed to paint the walls in a room. Our calculations will be similar to the Dummies article found here http://www.dummies.com/how-to/content/estimating-how-much-paint-to-buy.html To perform the calculation, you'll need to ask the user for some information about the room Total length (also known as the perimeter) of all the walls in the room (in feet). For example, a rectangular room that is 14x20 would have 14+20+14+20 = 68 feet in length. This value might be a floating point number. Use type double to represent it. Height of the walls (in feet). This value might be a floating point number. Use type double to represent it. Number of doors. This value should be an integer. For each door, you'll subtract 20 feet from the total square feet that needs to be painted. Use type int to represent it. Remember to create a named constant instead of hard coding the literal 20. Number of windows. This value should be an integer. For each window, you'll subtract 15 square feet from the total square feet to be painted. Use type int to represent it. Remember to create a named constant instead of hard coding the literal 15 Number of coats of paint required. This value should be an integer. If you are covering a dark color with a lighter one, for example, you might need 2 or 3 coats of paint to completely cover the original color. Use type int to represent it. Cost per gallon of paint. This value might be a floating point number. Use type double to represent it. The calculation begins by multiplying the total length of the walls by the height of the walls. This gives the rough number of square feet. Next, subtract out the appropriate amount for each door and window. What's left is the total square feet to be painted, per coat. Multiply this by the number of coats of paint desired and you'll have the total square feet that we need to buy paint for. Each can of paint should cover about 375 square feet, so take the number of square feet and divide by 375. Remember to create a named constant instead of hard coding the literal 375. The result is the minimum number of gallons of paint you need to buy. Since you can't buy partial gallons of paint, this will need to be rounded up to the next gallon if necessary. You will find the Math.Ceiling method helpful in this calculation. For example, gallonsToBuy (int)Math.Ceiling(minGallons); Display both the minimum gallons needed (with 1 decimal place of precision), the recommended (whole number) of gallons to buy (as an integer), and the total cost for the paint you have to buy. A version of the program as a Console application appears below. You can test your results using this data

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

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Compose the six common types of social business messages.

Answered: 1 week ago

Question

Describe positive and neutral messages.

Answered: 1 week ago