I am a new student to Jaca Programming. I need help finding out where I am going wrong with my code.
I am trying to have a user input 2 numbers and then have the input the calculation method of their choce. Add, subtact,multiply,divide.
package javaapplication10;
import java.util.Scanner;
/**
*
* @author cgigandet
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args, {
Scanner input = new Scanner(System.in);
boolean IsValid = true;
while(IsValid)
{
Scanner.out.println ("Enter larger number first : "); //request the input of the first interger
int num1 = input.nextInt();//request the input of the first interger
System.out.println ("Enter second number: "); //request the input of the second interger
int num2=Scanner.String.next();//request the input of the first interger
{
System.out.println("please choose a calculation method selecting menu item" +
" 1 - 5");
int calculation = input.nextInt();
if (calculation >=5)
{
System.out.println("Exit Program");
IsValid = false;
}
else{
switch(calculation)
{
case(1):
System.out.println("you entered add.");
System.out.println ("answer = ; " + (num1 + num2));
break;
case (2):
System.out.println("you entered subtract.");
System.out.println ("answer = ; " + (num1 + num2));
break;
case (3):
System.out.println("you entered multiply.");
System.out.println ("answer" + (num1 * num2));
break;
case (4):
System.out.println("you entered divide.");
System.out.println ("answer " + (num1 / num2));
break;
case (5) :
default:System.out.println("Exit.");
System.out.println("Exit.");
break;
}
}
}
}