Browse Source

MathFuntion was the name of the class

master
school 7 years ago
parent
commit
a23793f5e1
  1. 22
      files/MathProblems.java

22
files/MathProblems.java

@ -8,34 +8,30 @@ public class MathProblems
public void divide()
{
Scanner input = new Scanner(System.in);
int a=1;
int b=1;
try
{
System.out.print("Enter a: ");
int a = input.nextInt();
a = input.nextInt();
System.out.print("Enter b: ");
int b = input.nextInt();
b = input.nextInt();
}
catch(InputMismatchException ime)
{
System.out.println("Invalid input type");
}
catch( )
catch(ArithmeticException ae)
{
System.out.println("You can't divide "+a+" by "+b);
}
}
public static void main( String[] args )
{
// Test it here in main, when ready
MathFunctions functions = new MathFunctions();
MathProblems functions = new MathProblems();
functions.divide();
}
}
Loading…
Cancel
Save