Source: Mr. Sanford, BCC CIS73222
Site hosted by Angelfire.com: Build your free website today!

 

CIS73444.doc Lab Assignment 4 Due Tuesday 10-13-09

Object Oriented Java Programming

 

This week we are going to write an application program file that we will use to research how to write arithmetic expressions and Boolean expressions, as well as using String objects and control statements. We will be taking all of the data from the keyboard. Note that the application will have two major modules. The user should be able to re-run the complete application as many times as they like and re-run any module of the application as many times as they like. A prompt should be issued for all inputs including the response to continue a module or the complete application.

 

All output should contain titles and all double variables should be formatted with a reasonable number of decimal places using the DecimalFormat class.

 

Write one executable Java application file that will:

 

Module 1

 

The application should:

 

Prompt the user to enter the name of the module.

 

Prompt the user to enter the values for the base and altitude of an isosceles triangle.

 

The module should accept a decimal entry for altitude and an integer value for the base.

 

Assume the user will enter valid values for the altitude and base.

 

Display the module name, as well as the base and altitude of the triangle.

 

Calculate the area and perimeter of the triangle.

 

Display the area and perimeter of the triangle.

Prompt the user to select an option to continue running this module.

 

If the user selects “ to continue” then the module should “run again”,

otherwise it should fall through to module 2.

Module 2

 

The application should then continue to:

 

Prompt the user to enter the name of the module.

 

Prompt the user to a enter a destination city for an airline ticket.

 

Prompt the user to a enter a destination region code (1 digit 0 – 9).

 

Prompt the user to a enter an origin city.

 

Prompt the user to a enter an origin region code (1 digit 0 - 9)

 

Prompt the user to a enter the number of bags to be checked.

 

Assume the user will enter valid values for the region codes and number of bags checked.

 

Calculate the cost of the ticket. If the difference between the two region codes is greater than 5

then the ticket price is $189.00 and the cost per bag is $11.00, otherwise the ticket price

is $99.00 and the cost per bag is $5.00.

Display the module name

 

Display the destination city and the destination region code.

 

Display the origin city and the origin region code.

 

Display the number of bags checked.

 

Display the ticket price.

 

Prompt the user to select an option to continue running this module.

 

If the user selects “ to continue” then the module should “run again”,

otherwise it should fall through to the end of the application.

 

 

At the end of the application the user should be prompted to continue re-running the application

or return to the operating system.

 

 

Notes:

 

1. Label the end of all classes, methods, and blocks with a comment.

 

2. Line up the beginning brace { and ending brace } vertically for each block. (i.e. for each class, method, and block)

 

3. Indent all code between the beginning and ending braces so that the lineup of braces can be easily observed.

 

4. Include comments at the beginning of every .java source file with the assignment number, author, date due, and an essay (with paragraphs) at the start of the file describing the functionality of each class as well as how each class “works”. User instructions should also be provided. Are there comments reference important or complex syntax?

 

5. Insert dividers/separators (i.e. a line of dashes or a line of asterisks) between each method and class.

 

6. Capture your test results and paste them into the end of your .java source class file as comments.

 

7. Submit an electronic copy of your .java source class files (with the test results “pasted in” as comments) for credit. Note that all submissions should be made as attachments to an email, and sent to the instructor with the following subject line:

 

CIS73 Lab x

 

where x = the lab assignment number. Note that the subject line is case sensitive.

 

8. Note that assignments should be submitted on or before the due date for

full credit per the course policies.

 

9. Note once again that all duplicate .java files that are submitted for a grade will NOT be graded.

 

 

10. There is no substitution for adequate preparation.