A Java program that prompts a user to enter two numbers

Assignment 2

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 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 onl

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


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 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 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 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 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

We help you get better grades, improve your productivity and get more fun out of college!!

Do my Assignment for me








How it works – it’s easy


Place your Order

Submit your requirements through our small easy order form. Be sure to include and attach any relevant materials.

Make a payment

The total price of your order is based on number of pages, academic level and deadline.


Writing process

We assign the assignment to the most qualified tutor. When the tutor completes the assignment, it is transferred to one of our professional editors to make sure that the assignment meets all of your requirements.

Once complete, we’ll send your assignment via the email provided on the order form.



Achieve academic success with the best online tutors.