CMIS147 Introduction to Programing

profileebote
Assignment5.pdf

Assignment 5

Before attempting this project, be sure you have completed all of the reading assignments, non-

graded exercises, discussions, and assignments to date.

Write a Java program as follows:

(1) Prompt the user which action they want to take: (a) Convert cubic feet to U.S. bushels (b) Convert miles to kilometers (c) Determine graduation with honors title (d) Exit program

(2) Programs at a minimum must have the following methods: (a) Convert square feet method gets square feet and returns cubic yards (b) Convert to height method that gets height in inches and returns meters (c) Determine graduation with honors title method that gets GPA and returns honors title value

(3) For each action, the user should be prompted for corresponding data and given the appropriate output

(4) User should be able to select one action and then get prompted again for selection until they select exit choice

Use the following for calculations or category determination

• To convert from cubic feet to U.S. bushels use the formula: 1 cubic foot = 0.803564 U.S. bushel

• To convert from miles to kilometers use the following formula: 1 mile = 1.60934 km

• To determine graduation with the Honors title, create a method that uses a switch statement and the

following ranges

• For categories use:

o Cum Laude 3.5-3.7 o Magna Cum Laude 3.8-3.9

o Summa Cum Laude 4.0+

Test program:

A minimum of 4 test cases should be supplied in the form of a table with columns indicating the

input values, expected output, actual output, and if the test case passed or failed. This table

should contain 4 columns with appropriate labels and a row for each test case. An example

template is shown below. Note that the actual output should be the actual results you receive

when running your program and applying the input for the test record.

Make sure your Java program is using the recommended style such as:

• Javadoc comment upfront with your name as author, date, and brief purpose of the program

• Comments for variables and blocks of code to describe major functionality

• Meaningful variable names and prompts

• Identifiers are written in upper CamelCase

• Class name starts with upper case letter and variables in lower case letter

• Constants are written in All Capitals

• Use proper spacing and empty lines to make code human-readable

Capture execution:

You should capture and label screen captures associated with compiling your code and running

each of your test cases.

Here is a sample run:

RUN:

MENU

1: Convert cubic feet to U.S. bushels 2: Convert miles to kilometers 3: Determine graduation title with honors 9: Exit program Enter your selection: 1

Enter cubic feet: 5 5 cubic ft. = 4.01782 U.S. bushels

MENU

1: Convert cubic feet to U.S. bushels 2: Convert miles to kilometers 3: Determine graduation title with honors 9: Exit program Enter your selection: 2

Enter miles: 12 12 miles = 19.3121 km

MENU

1: Convert cubic feet to U.S. bushels 2: Convert miles to kilometers 3: Determine graduation title with honors 9: Exit program Enter your selection : 3

Enter GPA: 3.8 Congratulations, you have graduated Magna Cum Laude!

MENU

1: Convert cubic feet to U.S. bushels 2: Convert miles to kilometers 3: Determine graduation title with honors 9: Exit program Enter your selection: 9

Thank you for using the program. Goodbye!

Example test cases:

Input Expected Output Actual Output Pass?

Selection=1 cubic feet=5 5 cubic ft = 4.01782 U.S bushels

5 cubic ft = 4.01782 U.S bushels Yes

Test Case 2

Test Case 3

Test Case 4

Submission requirements

Deliverables include Java program (.java) and a single Word (or PDF) document. The Java and

Word/PDF files should be named appropriately for the assignment (as indicated in the

SubmissionRequirements document.

The word (or PDF) document should include screen captures showing the successful compiling

and running of each of the test cases. Each screen capture should be properly labeled clearly

indicated what the screen capture represents. The test cases table should be included in your

Word or PDF document and properly labeled as well.

Submit your files to Assignment 5 submission area no later than the due date listed in your

online classroom.

Grading Rubric:

The following grading rubric will be used to determine your grade:

Attribute Level (15-20 points)

Level (5-15 points)

Level 0 (0 - 5 points)

User input and loop Correct or one incorrect prompt

and/or captured

input and loop code

Two mistakes in

prompts and/or

capture of input

and/or loop

Three or more missing

elements for user input and/or

loop

Calculation and

output

Correct or one

mistake

in calculation

Two mistakes

in calculations

and/or output

Three ore more missing or

significantly incorrect

calculations and/or output

Methods Code is correctly

implemented using methods

Calculation code is

not all handled in

separate methods

Calculations are not

implemented as methods

Test Cases Correct or one incorrect test case

and/or test

execution

Two incorrect or

incomplete test cases

and/or test execution

Three or more missing or

significantly incorrect or

incomplete test cases

Program

documentation and

style

Correct or one

missing program

comment,

identifier, and/or

screen capture

Two incorrect

or incomplete

documentation

and/or style

elements

Three or more missing or

significantly incorrect

documentation and/or style

elements