Programming Assignment 1 Due January 28, 2015 at 11:59 PM Objectives • To practice with writing, compiling, and running a small C++ program. • To practice with basic C++ input/output features, along with some simple decimal formatting. • To practice with basic arithmetic operators in C++. Task Create a program (with the filename paint.cpp) that will calculate the amount of paint needed to cover one side of a house with a sloped roof. • Assume that this side wall of the house is generally shaped as in the diagram below (with rectangular lower section, and triangular section where the roof slopes to a point) and that it contains one rectangular window, which does not get painted (obviously). • As you can see in the sample execution, you should ask the user for the dimensions of the wall (width, height to the bottom of the slanted roof, height up to the tip of the slanted roof) and the dimensions of the window (width and height) – in this order. All of these dimensions should be of type double. • Assume that a can of paint will cover 400 square feet of wall (make this a constant integer variable, so that it’s simple to change this value in the program – for example, to represent larger cans of paint in future versions). • After collecting all of the dimensions, your program should produce the output demonstrated in the sample execution. Also note that: • The user-entered dimensions should be displayed in default format (only using a decimal point and digits to the right when needed). • The paintable area should be displayed to 1 decimal place. • The required number of cans should be displayed to 2 decimal places. 1 • Write your program so that the output looks EXACTLY like the sample execution shown below (this means same wording, spacing, and formatting of numbers). • Note: The underlining in the sample execution below is used to illustrate what the user is typing in – obviously the underlining will not appear on the console. • You may assume that user input will be correct (i.e. numeric entries and valid dimensions). General Requirements • No global variables. • All input and output must be done with streams, using the library iostream. • You may only use the iostream library (you do not need any others for these tasks). • When you write source code, it should be readable and well-documented (follow the style guidelines for programs). Sample run 1: (user input underlined) Welcome to Paint Calculator 2015!! How and and How and wide is the how high is how high is wide is the what is the wall (in feet)? 40 the wall to the bottom of the roof?15.7 the wall to the top of the roof? 21.5 window (in feet)? 3 window’s height? 2.75 A side wall that is 40’ wide and 15.7’ tall to the roof bottom and 21.5’ tall to the roof top, containing a window that is 3’ wide and 2.75’ tall, has 735.8 square feet of paintable wall and would require 1.84 cans of paint (assuming that each can will cover 400 square feet of wall). Thanks for using Paint Calculator 2015. Goodbye!! Sample run 2: (user input underlined) Welcome to Paint Calculator 2015!! How and and How and wide is the how high is how high is wide is the what is the wall (in feet)? 38.5 the wall to the bottom of the roof? 14.85 the wall to the top of the roof? 18.123 window (in feet)? 2.75 window’s height? 1.4 2 A side wall that is 38.5’ wide and 14.85’ tall to the roof bottom and 18.123’ tall to the roof top, containing a window that is 2.75’ wide and 1.4’ tall, has 630.9 square feet of paintable wall and would require 1.58 cans of paint (assuming that each can will cover 400 square feet of wall). Thanks for using Paint Calculator 2015. Goodbye!! Compiling and Running: This code only uses a standard library (iostream), so it will compile with any C++ compiler. Make sure you practice with MS Visual C++ 2012 (and make sure it reports no compile errors!) before you submit the program. Submitting: Program submissions should be done through Blackboard under the Assignments tab. Program submissions are due January 28 at 11:59 PM. 3