I have been trying to code this for days now even did research looked through the notes and everything I keep trying is not working and it's what is in the notes and readings, I done everything like it should me and keep getting errors. Here is the assignment:
import java.util.Scanner;
class Main {
public static void main(String[] args) {
// Scanner is used for getting input.
// Don't worry about this now.
Scanner input = new Scanner(System.in);
// These ints will be used for addition, subtraction and multiplication.
System.out.println("What numbers would you like to do math with?");
int x = input.nextInt();
int y = input.nextInt();
// Closing the scanner
input.close();
System.out.println(x + y);
// 2. Print the difference of x and y.
// 3. Print the product of x and y.
// 4. Print the quotient of x and y.
}
}
and these are the instructions:
Int Operations
Description:
This activity will show you how to do simple math operations to int values. The values of int x and int y will be asked for in the console when you run the application yourself. You will have to put in two numbers you want to use. However for the test you just have to provide the code for printing out the sum, difference, product and quotient for x and y. Please follow the steps below:
Steps:
Print the sum of x and y. (line 18)
Print the difference of x and y. (line 21)
Print the product of x and y. (line 24)
Print the quotient of x and y. (line 27)
Test:
Use the test provided. This test accounts for the print statements.
Sample:
Input:
10
2
10
2
Output:
What numbers would you like to do math with?
12
8
20
5
Please can anyone help me.