Question: Topics Basic input and output The five operators Lab 1 - Hello Math 1. Please copy the following code into your IDE and ensure it
Topics Basic input and output The five operators Lab 1 - Hello Math 1. Please copy the following code into your IDE and ensure it compiles. import java.util.*; public class Lab1 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); } } 2. Add two new lines of code. The first should create a new int variable and assign it an int value provided by the user. The second line should print out that variable to verify the variable was assigned correctly. 3. You now take input and return some output, but there is no context for the user. Add a line before the input to ask the user for a number, and a second message similar to You typed in: X where X is replaced by the number they typed in. 4. Now add a second message asking the user for a second number. Also add a second int variable to hold this value, get a second value from the user, and again print a message similar to the first one that contains this second number. 5. Write the code needed to produce this output: Addition = X Subtraction = X Multiplication = X Integer Division = X Modulus = X In each line of output, X should be the result of the given operation on the two numbers. For example, if the user inputs 5 as the first number and 3 as the second the first X would be 5 + 3, which gives 8 and the second would be 5 - 3 which gives 2, etc. Do not store the results of these operations in any variables. 6.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
