From 3c1db73467dc129771b2d9f5f2f2ba2b6675975f Mon Sep 17 00:00:00 2001 From: school Date: Tue, 4 Dec 2018 22:36:07 -0600 Subject: [PATCH] finished MathProblems.java --- files/MathProblems.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/files/MathProblems.java b/files/MathProblems.java index c2c71da..47b5548 100644 --- a/files/MathProblems.java +++ b/files/MathProblems.java @@ -9,13 +9,16 @@ public class MathProblems { Scanner input = new Scanner(System.in); int a=1; - int b=1; + int b=1; try { - System.out.print("Enter a: "); + System.out.print("Enter the numerator: "); a = input.nextInt(); - System.out.print("Enter b: "); + System.out.print("Enter the divisor: "); b = input.nextInt(); + int div = a/b; + int mod = a%b; + System.out.println(a+" / "+b+" is "+div+" with a remainder of "+mod); } catch(InputMismatchException ime) { @@ -25,7 +28,7 @@ public class MathProblems { System.out.println("You can't divide "+a+" by "+b); } - + } public static void main( String[] args ) @@ -35,3 +38,4 @@ public class MathProblems functions.divide(); } } +