I'm trying to computing a few things in a simple java application for school. A user must into 2 integers and once you input those variables in it will spit out the sum, product, quotient and difference. I am only able to get the program to spit out sum but not product, quotient and difference. any suggestions? here is my code:
// This is for HW problem #3
// An application that asks the user to enter two
// integers, obtains them from the user and prints their sum,
// product, difference and quotient (division).
import java.utl.Scanner; //program uses class Scanner
public class Solution
{
// main method begins execution of Java application
public static void ( String ags [] )
{
// create Scanner to obtain input from command window
Scanner input = new Scanner ( System.in );
int number1; //first integer to add
int number2; //second integer to add
int sum; // sum of number1 and number2
int product; //product of number 1 and number2
int differnec; //difference of number1 and number2
int quotient; //quotient of number1 and number2
System.out.print( "Enter first integer: " ); // prompt
number1 = input.nextInt(); // read first number from user
System.out.print( "Enter second integer: " ); // prompt
number2 = input.nextInt(); // read second number from user
sum = number1 + number 2; // add numbers
product = number1 * number2; // multiply numbers
difference = number1 - number2; // subtract numbers
quotient = number1 / number2; // divide numbers
System.out.printf( " Sum is %d\n ", sum ); //display sum
System.out.printf( " Product is %d\n ", product ); //display prouduct
System.out.printf( " Difference is %d\n ", difference ); //display difference
System.out.printf( " Quotient is %d\n ", quotient ); //display quotient
} // end method main
} // end class Addition