UMBC CMSC104 CSEE

CMSC104

Problem Solving and Computer Programming

 

Project 4 -- Interior Decorating

Due

Project 4 is worth 100 points and due at 11:59pm, Thursday, 11 May 9 May

Requirements

Create a file named jdoe2p4.c, using the editor of your choice.

Develop an interactive program that will calculate the square feet of wall-to-wall carpet needed to carpet a house and the number of gallons necessary to paint the house. Additionally, you will calculate the cost of the paint and carpet. The ceilings are painted the same color, and all walls have a different color, for this program, we do not care what color. When calculating the amount of paint that is necessary, we will not be concerned with what happens to the windows and the walls. (We are not good painters.)

Calculations must be the result of the totals of each of the rooms in the house. Determine the amount of paint for the ceiling, walls, and the carpet and add that to the total needed for the house. You must write a separate function to determine each of these amounts. Use a function to get the length and width of each room, one room at a time.. Determine the cost for the carpet, ceiling paint, and wall paint, each in a separate function.

You must get the width and length of each room from the user. Perform the calculations and report the results, with a separate function. The format of the report is given in the example below.

You must do error checking on all inputs.

Hierarchical chart

Assumptions I Am Making

1 gallon of paint covers 1,000 square feet of surface.
Paint costs $43.50 a gallon, no matter what color
The carpet costs $15.23 a square foot, installed.
Every room in the house has the same height.
The ceiling is painted the same shade of white throughout the house, so you can only ask for the height once.
All rooms are rectanglar in shape.
All walls are painted the same color.

Compiling

Compile the program with the following command: If you get an error or warning, and you probably did, simply go back into the editor and fix it. Then recompile, continuing until you get no warnings or errors.

Executing

Execute the program with the following command: ./a.out If everything worked correctly, you should get the messages giving the distances.

One Sample Output

(User input is in green.)
burt[146]: a.out
Enter the height: 8
How many rooms are there in the house?  3

 ******************** Room #1 ****************
Enter the length: 10
Enter the width: 10

 ******************** Room #2 ****************
Enter the length: 15
Enter the width: 15

 ******************** Room #3 ****************
Enter the length: 18
Enter the width: 23


The carpet cost is $11254.97.
The ceiling paint cost is $43.50.
The wall paint cost is $87.00.
burt[147]:

  

Notice that the UNIX prompt must be on the next line!

Turning In Your Project

Once you have everything absolutely correct, you must use Blackboard to submit the project to the TA for grading. Do not email it to the instructor because you will lose points for not following instructions!

When submitting the assignment, I only want the file jdoe2p4.c. Please make the title and the file name the same when you submit it! If you submit a file named jdoe2p4.c, the way we save the material delete everything but the last file with than name. Therefore, your file will be lost and we will give you a zero!!!! Use your login ID!!!

Grading

This project will be grade using the following scale:

Documentation 25 points
Correct Results25 points
Correct Sytle25 points
Other25 points

You will lose 5 points if you do not name the file correctly.
You will lose 5 points if you email the project instead of submitting it via Blackboard.
You will lose 5 points if the prompt is not on the next line.

Comments Required

        /*****************************************************/
        /* Program Header Block                              */
        /* Filename:       jdoe2p4.c                         */
        /* Name:           Ima Student                       */
        /* Email:          jdoe2@umbc.edu                    */
        /* Date:           11 May 2006                       */
        /* Course/section: CMSC-104                          */
        /* Description:                                      */
        /*     Analysis:                                     */
        /*         Input:                                    */
        /*         Output:                                   */
        /*         Constraints:                              */
        /*         Formulas:                                 */
        /*         Assumptions:                              */
        /*     Design:                                       */
        /*         (Your psuedocode goes here.)              */
        /*                                                   */
        /* Notes:          (As needed.)                      */
        /*****************************************************/
        

Function Header Comment Block (One for each function)

/*********************************************************** 
 * Function name:    function_name                         *
 * Description:      (Your function psuedocode goes here)  *
 * Input Parameters: Name and data type of each parameter. *
 * Return Value:     Data type and description of what     *
 *                   the return value is.                  * 
 ***********************************************************/
  


UMBC | CSEE