forked from haonlywan/CodeHS-Java-APCSA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3.2.7 Sweet or Unsweet?
27 lines (25 loc) · 931 Bytes
/
3.2.7 Sweet or Unsweet?
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;
public class DrinkOrder
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
// Start here!
// You'll find it helpful to list the steps you
// need to take, then write the code
//ask user what they want to drink
System.out.println("What do you want to drink?");
String drink = input.nextLine();
//ask user how many teaspoons of sugar they want
System.out.println("How many teaspoons of sugar do you want?");
int sugAmount = input.nextInt();
//confirm order
if (sugAmount > 0){
System.out.println("Confirming your order. You wanted:");
System.out.print(drink + " with sugar");
} else{
System.out.println("Confirming your order. You wanted:");
System.out.print(drink);
}
}
}