Project 01

 

Overview

In a class named App, develop a menu-driven, console program for calculating the area of some standard geometric shapes.

 

Processing

Your program must perform the following processing:

  1. Display this menu of processing options

   
         Shape Menu
   
     1 - Circle
     2 - Rectangle
     3 - Triangle
     4 - Author information
     5 - Exit
   
     Enter selection: 
   
  1. Read the user's menu selection

  2. Use a switch statement to process the user's choice. The requirements for each selection are as follows:

Circle - When the user selects this item, prompt for and read the radius of the circle as a real number. If the value entered is greater than zero, calculate and display the area of the circle to two decimal places. Otherwise, display an appropriate error message and allow them to re-enter the radius until they enter a valid value. The formula you will need is

Area = pR2

where the value of p is readily obtained by coding:    Math.PI

Rectangle - When the user selects this item, prompt for and read the length and width of the rectangle as real numbers. If the values entered are greater than zero, calculate and display the area of the rectangle to two decimal places. Otherwise, display an appropriate error message and allow them to re-enter the data until they enter valid values. The formula you will need is

Area = LW

Triangle - When the user selects this item, prompt for and read the base and height of the triangle as real numbers. If the values entered are greater than zero, calculate and display the area of the triangle to two decimal places. Otherwise, display an appropriate error message and allow them to re-enter the data until they enter valid values. The formula you will need is

Area = BH/2

Author information - When the user selects this item, simply display your name in a format of your choice.

Exit - When the user selects this item, display an appropriate termination message in a format of your choice. The program should then end.

If any other selection is made, display an appropriate error message.

  1. If the user hasn't chosen to exit, repeat steps 1 through 3

 

Miscellaneous 

 

Grading criteria

Your program will be worth 30 points to be awarded as follows:

 

Submission

E-mail me the contents of your App.java source file no later than midnight on the program due date. If you are using JBuilder 4 and the Test project previously copied from the College of Business network, this file will be in the src folder of the project. In the College of Business labs, the complete path of your source file is:

D:\Test\src\App.java

To verify that you are doing this properly, e-mail to yourself, copy the source code to your test project, and re-test the program. If it works for you, it will probably work for me.

Upon receipt of your project, I will send you a verification message. When your project has been graded, you will receive an e-mail with your project score and comments (based on the above criteria). All project scores will be posted on the Internet within a few days after the due date.