-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrinks.java
More file actions
26 lines (21 loc) · 870 Bytes
/
Drinks.java
File metadata and controls
26 lines (21 loc) · 870 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
package com.promineotech;
import java.util.Scanner;
public class Drinks {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Is it hot outside? Enter true or false");
boolean isHotOutside = sc.nextBoolean();
System.out.println("How much money do you have in your pocket right now? (Be sure to input a decimal number).");
double moneyInPocket = sc.nextDouble();
System.out.println(willBuyDrink(isHotOutside, moneyInPocket));
}
// Write a method called willBuyDrink that takes a boolean isHotOutside, and a double moneyInPocket, and returns true if it is hot outside and if moneyInPocket is greater than 10.50
public static boolean willBuyDrink(boolean isHotOutside, double moneyInPocket) {
if ((isHotOutside == true) && (moneyInPocket > 10.50)){
return true;
}
else {
return false;
}
}
}