-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCh5Ex2.java
More file actions
31 lines (30 loc) · 861 Bytes
/
Ch5Ex2.java
File metadata and controls
31 lines (30 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Scanner;
public class Ch5Ex2
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Enter Numerator: ");
int userNum = input.nextInt();
System.out.println("Enter Denominator: ");
int userDen = input.nextInt();
Fraction userFract = new Fraction(userNum, userDen);
while (true)
{
System.out.println("----- Compare to this fraction------");
System.out.println("Enter Numerator: ");
userNum = input.nextInt();
System.out.println("Enter Denominator: ");
userDen = input.nextInt();
System.out.print(userFract.equals(new Fraction(userNum, userDen)));
System.out.println(" [Fractions Equal?]");
System.out.println("Quit? [y/n] :");
String loopControl = "";
loopControl = input.next();
if (loopControl == "y")
break;
else
continue;
}
}
}