-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_order.java
133 lines (80 loc) · 4.1 KB
/
custom_order.java
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Code for Beginning Java's Cake & Cupcake Shop Tutorial
import java.util.Scanner; // Needed for the Scanner class to read input
public class custom_order {
// STEP 1 PRINTING HELLO WORLD TO CONSOLE
public static void main(String[] args) {
// System.out.println("Hello World!"); // print Hello World to console
// TEST CODE
// STEP 2 CREATE A SCANNER OBEJCT, DECLARE VARAIBLES, & PRINT STATEMENTS
Scanner keyboard = new Scanner (System.in);
String firstName; // User's first name
String itemOrder; // Item ordered
String frostingType; // Frosting ordered
String fillingType; // Filling ordered
String toppings; // Toppings ordered
String input; // User input
String itemType; //declaring a new variable
itemType = ("Cake / Cupcake"); //variable, setting the value for it. just experimenting
double cost = 15.00; // Cost of cake and cupcakes
final double TAX_RATE = .08; // Sales tax rate
double tax; // Amount of tax
// Introduce shop and prompt user to input first name
System.out.println("Welcome to Java's Cake & Cupcake Shop!");
System.out.println("We make custom cakes with our secret cake batter!");
// TEST CODE
// STEP 3 INPUT YOUR NAME AND PREPARE TO VIEW MENU
System.out.print("What is your first name? ");
firstName = keyboard.nextLine();
System.out.print(firstName + ", please see our MENU below: ");
System.out.print("\n"); // skips a line
// TEST CODE
// STEP 4 DISPLAY MENU
System.out.println("_______________________________________________");
System.out.println(" MENU QUANTITY BASE COST ");
System.out.println("_______________________________________________");
System.out.println(" Cake 1 $15 ");
System.out.println(" Set of Cupcakes 6 $15 ");
System.out.println("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _");
System.out.println("Frostings (vanilla, chocolate, strawberry, coco)");
System.out.println("Fillings (mocha, mint, lemon, caramel, vanilla)");
System.out.println("Toppings (sprinkles, cinnamon, cocoa, nuts)");
System.out.println("_______________________________________________");
System.out.println("I am just testing this line of code I am " + firstName); //it actually fucking works!
// TEST CODE
// STEP 5 PROMPT USER TO ORDER
System.out.println("Do you want CUPCAKES or a CAKE?");
System.out.println(itemType);
itemOrder = keyboard.nextLine();
// TEST CODE
// STEP 6 PROMPT USER TO CHOOSE FROSTING
System.out.println("What type of FROSTING do you want? ");
System.out.println("Vanilla, Chocolate, Strawberry or Coco");
frostingType = keyboard.nextLine();
//TEST CODE
// STEP 7 PROMPT USER TO CHOOSE FILLING
System.out.println("What type of FILLING do you want? ");
System.out.println("Mocha, Mint, Lemon, Caramel or Raspberry");
fillingType = keyboard.nextLine();
// TEST CODE
// STEP 8 PROMPT USER TO CHOOSE TOPPINGS
System.out.println("What type of TOPPINGS do you want? ");
System.out.println("Sprinkles, Cinnamon, Cocoa, Nuts");
toppings = keyboard.nextLine();
// TEST CODE
// STEP 9 DISPLAY ORDER CONFIRMATION
System.out.println();
System.out.println(firstName + " , your order is as follows: ");
System.out.println("_________________________________________");
System.out.println("Item Ordered: " + itemOrder);
System.out.println("Frosting: " + frostingType);
System.out.println("Filling: " + fillingType);
System.out.println("Toppings: " + toppings);
System.out.println("_________________________________________");
// TEST CODE
// STEP 10 DISPLAY COST AND SALES TAX
System.out.printf("The cost of your order is: $%.2f\n", cost);
tax = cost * TAX_RATE;
System.out.printf("The tax is: $%.2f\n", tax);
System.out.printf("The total due is: $%.2f\n",(tax + cost));
}
}