-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy path3.1.6 Meeting Goals
More file actions
23 lines (22 loc) · 833 Bytes
/
3.1.6 Meeting Goals
File metadata and controls
23 lines (22 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class Goals
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
// Ask for goal amount
System.out.println("Enter your goal:");
int goalAmount = input.nextInt();
// Ask for actual amount
System.out.println("Enter your actual amount:");
int actAmount = input.nextInt();
// Compare numbers by creating three booleans
boolean overGoal = actAmount > goalAmount;
boolean notGoal = actAmount < goalAmount;
boolean gotGoal = actAmount == goalAmount;
// Display results as instructed
System.out.println("Went over goal? " + overGoal);
System.out.println("Did not meet goal? " + notGoal);
System.out.println("Met goal exactly? " + gotGoal);
}
}