UMBC CS 201, Fall 01
UMBC CMSC 201 Fall '01 CSEE | 201 | 201 F'01 | lectures | news | help

CMSC 201
Programming Project One

M & B Concrete

Out: Wednesday 9/26/01
Due: Before Midnight, Wednesday 10/3/01

The Objective

The objective of this assignment is to get you started writing programs in C in a UNIX environment. Its main emphasis is design, so we will be designing the project together in class. You should keep in mind all of the design techniques that we've covered in class, including top-down design, writing functions that do only one thing, writing functions to be general, and using symbolic constants instead of having "magic numbers" within your code. This project will also give you practice writing functions, loops, and a switch statement.

The Background

M & B Concrete is a small home improvement company that specializes in building concrete sidewalks, driveways and patios. The owner of the company has hired you to write a program that he can use to find the cost of the cement and its delivery for each project. This will help him in the bidding process for all of his jobs.

Concrete is delivered by a mixer truck and is purchased by the "yard". When speaking about concrete, the phrase "a yard of concrete" actually means one cubic yard of concrete. The current price of concrete is $ 3.50 per yard. If the order is small, then there is a delivery charge of $ 50.00. Orders of 25 or more yards of concrete have free delivery.

M & B uses standard thicknesses for each of their products. Sidewalks are always 4 inches thick, driveways are 6 inches thick, and patios are 6 inches thick.

After printing a greeting for the user, we should present the user with a menu of pricing choices.

The choices available to the user are :

  1. Price a Sidewalk
  2. Price a Driveway
  3. Price a Patio
  4. Quit

After that item has been priced, the menu should be presented again so that the user can continue to price other projects.

The Task

Design (to be done in class) and code a project that after printing a greeting to the user, presents the user with a menu which allows him to choose to price a sidewalk, a driveway or a patio.

The user's choice will determine which thickness to use in the calculations of the volume of cement necessary. After getting the menu choice, the user should be prompted for both the length and the width of the item. These dimensions are to be given in feet and inches.

Rules about Dimensions:

Once the dimensions are obtained, the program needs to calculate the number of yards of cement that need to be ordered and present the user with that number, the cost per yard, whether or not there was a delivery charge and the amount of that charge, and the total cost of the cement (including delivery).

After accomplishing the requsted task, the user should be presented with the menu again, so that s/he can continue to make choices.

The program should not terminate until the user has chosen quit from the menu.

Sample Run

linux3[72] % gcc -Wall -ansi proj1.c linux3[73] % a.out Your greeting goes here 1 - Price a Sidewalk 2 - Price a Driveway 3 - Price a Patio 4 - Quit Enter your choice : 1 Pricing your sidewalk : Please enter the length in feet and inches feet : 27 inches : 0 Please enter the width in feet and inches feet : 3 inches : 0 Your project requires 1 yard(s) of concrete at $ 3.50 per yard The delivery charge is $ 50.00 Total cost : $ 53.50 plus tax 1 - Price a Sidewalk 2 - Price a Driveway 3 - Price a Patio 4 - Quit Enter your choice : 1 Pricing your sidewalk : Please enter the length in feet and inches feet : 27 inches : 0 Please enter the width in feet and inches feet : 3 inches : 1.5 Your project requires 2 yard(s) of concrete at $ 3.50 per yard The delivery charge is $ 50.00 Total cost : $ 57.00 plus tax 1 - Price a Sidewalk 2 - Price a Driveway 3 - Price a Patio 4 - Quit Enter your choice : 2 Pricing your driveway : Please enter the length in feet and inches feet : 100 inches : 0 Please enter the width in feet and inches feet : 20 inches : 0 Your project requires 38 yard(s) of concrete at $ 3.50 per yard There is no delivery charge for an order this large. Total cost : $ 133.00 plus tax 1 - Price a Sidewalk 2 - Price a Driveway 3 - Price a Patio 4 - Quit Enter your choice : 3 Pricing your patio : Please enter the length in feet and inches feet : 25 inches : 9 Please enter the width in feet and inches feet : 15 inches : 3 Your project requires 8 yard(s) of concrete at $ 3.50 per yard The delivery charge is $ 50.00 Total cost : $ 78.00 plus tax 1 - Price a Sidewalk 2 - Price a Driveway 3 - Price a Patio 4 - Quit Enter your choice : 0 0 is not a valid choice Enter your choice : 5 5 is not a valid choice Enter your choice : 2 Pricing your driveway : Please enter the length in feet and inches feet : 0 inches : 0 A dimension of 0 is not allowed. Try again feet : -2 Dimensions must be positive ! Try Again feet : 15 inches : -5 Dimensions must be positive ! Try Again inches : 0 Please enter the width in feet and inches feet : 0 inches : 0 A dimension of 0 is not allowed. Try again feet : -7 Dimensions must be positive ! Try Again feet : -1 Dimensions must be positive ! Try Again feet : 10 inches : -3 Dimensions must be positive ! Try Again inches : 3.5 Your project requires 3 yard(s) of concrete at $ 3.50 per yard The delivery charge is $ 50.00 Total cost : $ 60.50 plus tax 1 - Price a Sidewalk 2 - Price a Driveway 3 - Price a Patio 4 - Quit Enter your choice : 4 linux3[74]

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

Please be aware that this is definitely NOT a complete test of the program. Your testing should be much more extensive.

Input Guarantees

Further Specifications

Submitting the Program

Your C source code file MUST be called proj1.c.

To submit your project, type the following at the Unix prompt. Note that the project name starts with uppercase 'P'.

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 the file that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 Proj1


CSEE | 201 | 201 F'01 | lectures | news | help

Wednesday, 26-Sep-2001 09:35:47 EDT