Question: New to Java; Been reading our textbook to get answers, but I just don't understand. Please help with the following! Create a class called MathTest

New to Java; Been reading our textbook to get answers, but I just don't understand. Please help with the following!

Create a class called MathTest

Outside of the class, import the Scanner library

Create a method called main

Inside main:

  1. Declare two integer variables and two double variables
  2. Instantiate a Scanner object
  3. Using print, display two lines that allows the user to enter in the two integer values on the same line as the prompt.
  4. Using print, display two lines that allows the user to enter in the two double values on the same line as the prompt.
  5. Using multiple printf statements, display the result of adding, subtracting, multiplying, dividing and moding the two integer values.
  6. Using multiple printf statements, display the result of adding, subtracting, multiplying, and dividing the two double values.
  7. Make sure that there is a title before each of the two outputs and there are blank lines between the input section and the two output sections.
  8. Comment your code.

Submit the .java file and a screen shot in Canvas

Screen Shot:

Input integer value 1: 5

Input integer value 2: 2

Input double value 1: 5.25

Input double value 2: 3.14

Integer output:

Adding 5 and 2 = 7

Subtracting 5 and 2 = 3

Multiplying 5 and 2 = 10

Dividing 5 and 2 = 2

Moding 5 and 2 = 1

Double output:

Adding 5.25 and 3.14 = 8.39

Subtracting 5.25 and 3.14 = 2.11

Multiplying 5.25 and 3.14 = 16.49

Dividing 5.25 and 3.14 = 1.67

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!