UMBC CS 201, Spring 99
UMBC CMSC 201 Spring '99 CSEE | 201 | 201 S'99 | lectures | news | help

CMSC 201
Programming Project One

B & F Painting Company

Out: Wednesday 2/17/99
Due: Midnight, Wednesday 2/24/99

The Objective

The objective of this assignment is to get you started writing programs in C in the UNIX environment. This project will give you practice using loops, and mixing data types.

The Background

You have been hired as an entry-level programmer by the famous "B & F Painting Company". B & F specializes in selling only the highest quality "semi-gloss" paints. B & F paint sells for $19.95 per gallon. Each gallon of B & F's superior paint covers 50 square feet of wall space. If you do a good job, the owners of B & F have promised to paint your house free of charge!

The Task

Your assignment is to write a program for B & F that can be used with B & F customers to calculate the amount and cost of paint for rooms of various size. Your program will ask the user for the number of rooms in his house. For each room, your program will ask the user for the room dimensions (in feet), calculate the wall space to be painted (in square feet), and the number of gallons necessary to paint the wall, and the cost of the paint for the room. Remember that the user cannot buy part of a gallon of paint. After the user has entered dimensions for all rooms, your program will then display the total number of gallons and the total cost for all rooms.

Be sure your program is robust and guards against invalid input. (I've never seen a house with less than 1 room, nor can I imagine a room with a negative dimension.)

You may assume that all rooms dimensions are an integral number of feet (no fractional feet or inches).

Sample Run

retriever[102] a.out Welcome to the Paint Shop Calculator! We will calculate your total paint needs and cost. Our superior quality paint covers 50 sqaure feet per gallon. How many rooms in your house? 0 I've never seen a house with 0 rooms Please enter a positive value How many rooms in your house? -1 I've never seen a house with -1 rooms Please enter a positive value How many rooms in your house? 2 Enter dimensions for room 1 in feet Length: 1 Width: 12 Height: 0 Please enter only positive dimensions Enter dimensions for room 1 in feet Length: 9 Width: 9 Height: 10 Total wall space for Room 1 is 360 square feet Room 1 will require 8 gallon(s) of paint Total paint cost for room 1 is $159.60 Enter dimensions for room 2 in feet Length: 8 Width: 8 Height: 8 Total wall space for Room 2 is 256 square feet Room 2 will require 6 gallon(s) of paint Total paint cost for room 2 is $119.70 Thank you for shopping with B & F Paints! The house requires 14 gallon(s) of paint Total house cost is $279.30 retriever[103]

Althoug your output need not be identical to the above, all information (including the greeting) must be present.

Submitting the Program

Your C source code file for this project MUST be called proj1.c.
To submit your project, type the following at the Unix prompt:

submit cs201 proj1 proj1.c

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 proj1


CSEE | 201 | 201 S'99 | lectures | news | help

Friday, 12-Feb-1999 14:03:41 EST