-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
82 lines (60 loc) · 2.22 KB
/
Main.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
import java.util.InputMismatchException;
import java.util.Scanner;
public class Main {
public static void main( String [] args) {
Scanner input = new Scanner(System.in);
CartTotal addcart = new CartTotal();
ShoppingList myList = new ShoppingList();
int userOpt = 0;
while (userOpt != 4) {
System.out.println("");
System.out.println("----- Welcome to My Shopping List------");
System.out.println("(1) Please add an item to the list. ");
System.out.println("(2) Display list and total number of items. ");
System.out.println("(3) Add Cart total. ");
System.out.println("(4) Exit ");
try{
userOpt = input.nextInt();
switch (userOpt) {
case 1: {
myList.addItem();
}
case 2: {
myList.displayItem();
}
case 3:{
addcart.input();
addcart.multiply();
addcart.result();
}
}
}catch(Exception e){
System.out.println("Input not recognized. Please select an option.");
break;
}
}
}
}
//case 3:{
//st.input();
//st.add();
// st.result();
//}catch(Exception e){
// System.out.println("Input not recognized. Please select an option.");
// break;
// }
// }
// * 4 Pillars of OOP
// * Must create and use at least 3 Constructors
// * Must have at least 4 methods
// * Must include a section to get responses from User
// * Must contain a switch statement
// * Must handle at least 1 exception
// * Project must include at least 3 Classes
// * Use one of the Collections structures.
// * Use a loop to traverse through your Collection structure that you chose and modify,// * organize, or return values from the iteration.
// * ex. Sort my structure, Search, find and return object
//inheritance, **abstraction, **constructor
//create new instance of main class
//add additional function that will create summation of add list total
//