UMBC CMSC104

Project 3 - Boxes

Due Dates

Section 0201: Wednesday, 12/6 by midnight
Section 0601: Friday, 12/1 by midnight

NO LATE PROJECTS WILL BE ACCEPTED!

Point Value

This assignment is worth 100 points.

Objectives

Assignment

Your program will prompt the user to enter the width, height, and depth of a box. It will allow the user to enter only positive integers as the dimensions of the box by error checking each dimension as it is entered. The program should make the user keep entering a value until he/she enters a positive integer. You MAY assume that the user will enter only integers (i.e., no real numbers or characters will be entered). See the Sample Program Run below.

Once the user has entered valid values for width, height, and depth, the program will ask the user for a character with which to draw the different surfaces of the box.

Next, the program will present the user with a menu of options. The options are shown in the Sample Program Run below.

The functions you will write, in addition to the main function, are:

Each function corresponds to a menu option. The menu should continue to display until the user enters a Q for quit. You should only allow the user to enter UPPERCASE menu options.

Sample Program Run

Here is a sample run of the program.

Enter the width: 0 Please enter a positive integer: -2 Please enter a positive integer: 5 Enter the height: -1 Please enter a positive integer: 7 Enter the depth: 0 Please enter a positive integer: 4 Enter a character to be used to draw: # Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: B B is an invalid menu option. Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: a a is an invalid menu option. Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: A The surface area is: 166 Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: V The volume is: 140 Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: F ##### ##### ##### ##### ##### ##### ##### Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: T ##### ##### ##### ##### Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: S #### #### #### #### #### #### #### Menu A -- Calculate the Surface Area of the Box V -- Calculate the Volume of the Box F -- Display the Front/Back of the Box T -- Display the Top/Bottom of the Box S -- Display the Side of the Box Q -- Quit Selection: Q

Your program's output should follow this EXACT formatting.

Coding Standards and Indentation

Make sure that you follow the "C Coding Standards" and "Indentation Styles" given on the Projects web page. Your program will be graded not only on whether or not it produces the correct results, but also on whether or not you follow these standards and styles.

Project Submission

Submit your project by e-mailing your source code (proj3.c) to Evelyn (cwang3@cs.umbc.edu) as an attachment. Make the Subject of the e-mail Project 3 so that Evelyn knows what it is. Do NOT send your executable file (a.out).


Last Modified: Friday, 17-Nov-2000 16:28:17 EST

Friday, 17-Nov-2000 16:28:17 EST