Assignment 2

Before attempting this project, be sure you have completed all of the reading assignments, nongraded exercises, discussions, and assignments to date.
Write a Java program which:
(1) Prompts a user to enter two numbers between 200 and 1000 and a symbol for operation
such as ‘+’, ‘-‘, ‘*’,and ‘/’ (use Scanner for input).
(2) Code uses nested if statement or switch to perform the operation on the two numbers
(3) If the provided symbol is valid, displays the input data along with the result of the calculation
to the console. Otherwise displays an error message
For example, for input: 700 950 + the calculation is addition and the result will be 1650
Note 1: To read a single character by Scanner, you can read in as a string and then use the
first character. For example: scan.next().charAt(0)
Note 2: Be careful you do not have integer division
Note 3: If user inputs invalid symbol, print an error message only
Test program:
A minimum of 5 test cases (one for each valid operation and one for invalid operation) 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 5 test cases.
Here are a couple of sample runs:
Enter two integer numbers between 200 and 1000
separated by a space: 200 650
Enter operation symbol (+, -, *, or /): +
Evaluation: 200 + 650 = 850.0
Enter two integer numbers separated by space: 550
800
Enter operation symbol (+, -, *, or /): (
Not valid operation symbol
Example test cases:
Input Expected Output Actual Output Pass?
number 1 = 200
number 2 =
650
operation = +
Enter two integer
numbers separated by
space: 200 650
Enter operation symbol (+, –
, *, or /): +
Evaluation: 200 + 650 =
850.0
Enter two integer numbers
separated by space: 200
650
Enter operation symbol (+, -,
*, or /): +
Evaluation: 200 + 650 = 850.0
Yes
Test Case 2
Test Case 3
Test Case 4
Test Case 5
Submission requirements
Deliverables include a Java program (.java) and a single Word (or PDF) document. The Java
andWord/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 to
indicate 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 the Assignment 2 submission area no later than the due date listed in
youronline 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 Correct or one
incorrect prompt
and captured input
Two mistakes in
prompts and/or
capture of input
Three or more missing
essential elements for user
input
Calculation Correct or one
mistake in
calculation
Two
mistakes in
calculations
Three or more missing or
significantly incorrect
calculations
Application output Correct or one
mistake in
output
Two mistakes
in output data
or format
Three or more missing or
significantly incorrect
output
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

"Get Help With Your Essay
. If you need assistance with writing your essay, our professional essay writing service is here to help!

Order Now