forked from haonlywan/CodeHS-Java-APCSA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.9.8 Guess the number! (Part 1)
27 lines (26 loc) · 1.15 KB
/
2.9.8 Guess the number! (Part 1)
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
import java.util.Scanner;
import java.lang.*;
public class ExtremeMain
{
public static void main(String[] args)
{
// Create a Scanner object
Scanner input = new Scanner(System.in);
// Create an Extremes object
Extremes x = new Extremes();
// Ask the user to guess the maximum value of an Integer
System.out.println("What do you think the maximum integer value is?");
int guessMax = input.nextInt();
// Compute and display what they'd need to multiply by
// to reach the maximum number
int multDiff = x.maxQuotient(guessMax);
System.out.println("You'd need to multiply your number by " + multDiff + " to reach tha max value!");
// Ask the user to guess the minimum value of an Integer
System.out.println("What do you think the minimum integer value is?");
int guessMin = input.nextInt();
// Compute and display what they'd need to multiply by
// to reach the minimum number
int multDiffMin = x.minQuotient(guessMin);
System.out.println("You'd need to multiply your number by " + multDiffMin + " to reach the min value!");
}
}