@@ -6,21 +6,6 @@ public static void main(String[] args) {
6
6
7
7
Database db1 = new Database ();
8
8
9
- System .out .println ("1.Administrator\n " +
10
- " a. Insert product/category\n " +
11
- " b. Delete product/category\n " +
12
- " c. Search product\n " +
13
- " d. Modify product\n " +
14
- " e. Exit as Administrator\n " +
15
- "2.Customer\n " +
16
- " a. Add funds (assume all integer operations)\n " +
17
- " b. Add product to the cart\n " +
18
- " c. Check-out cart\n " +
19
- " d. Exit as Customer\n " +
20
- "3. Exit" );
21
-
22
-
23
-
24
9
Admin a1 = new Admin (db1 );
25
10
// Customer m1 = new Customer(0, db1);
26
11
// a1.InsertProdCat("a>b>f", "h", 2, 2, 1);
@@ -51,22 +36,45 @@ public static void main(String[] args) {
51
36
// System.out.println("testing");
52
37
53
38
while (true ){
39
+ System .out .println ("1.Administrator\n " +
40
+ " a. Insert product/category\n " +
41
+ " b. Delete product/category\n " +
42
+ " c. Search product\n " +
43
+ " d. Modify product\n " +
44
+ " e. Exit as Administrator\n " +
45
+ "2.Customer\n " +
46
+ " a. Add funds (assume all integer operations)\n " +
47
+ " b. Add product to the cart\n " +
48
+ " c. Check-out cart\n " +
49
+ " d. Exit as Customer\n " +
50
+ "3. Exit" );
51
+ // System.out.println("Enter Option");
54
52
int opt = takeIntInput ();
55
53
if (opt == 1 ){
56
54
int fl =1 ;
57
-
58
55
while (fl ==1 ) {
56
+ System .out .println ("Administrator\n " +
57
+ " a. Insert product/category\n " +
58
+ " b. Delete product/category\n " +
59
+ " c. Search product\n " +
60
+ " d. Modify product\n " +
61
+ " e. Exit as Administrator" );
62
+ // System.out.println("Enter Option");
59
63
String opType = sc .next ();
60
64
switch (opType ) {
61
65
case "a" :
62
66
63
67
System .out .println ("(a)Product or (b)Category?" );
64
68
String inp = sc .next ();
69
+ System .out .println ("Enter path of product/category" );
65
70
String path = sc .next ();
66
71
if (inp .equals ("a" )) {
72
+ System .out .println ("Enter product's name" );
67
73
String productName = sc .next ();
68
- System .out .println ("Enter product's price and details" );
69
- int price = takeIntInput (), UnitsAvail = takeIntInput ();
74
+ System .out .println ("Enter product's price" );
75
+ int price = takeIntInput ();
76
+ System .out .println ("Enter product's no of available units" );
77
+ int UnitsAvail = takeIntInput ();
70
78
71
79
a1 .InsertProdCat (path , productName , price , UnitsAvail , 1 );
72
80
} else {
@@ -76,20 +84,27 @@ public static void main(String[] args) {
76
84
77
85
break ;
78
86
case "b" :
87
+ System .out .println ("Enter path of product/category" );
79
88
path = sc .next ();
80
89
a1 .delete (path );
81
90
82
91
break ;
83
92
84
93
case "c" :
94
+ System .out .println ("Enter name of product to search" );
85
95
String productName = sc .next ();
86
96
a1 .search (productName );
87
97
88
98
break ;
89
99
90
100
case "d" :
101
+ System .out .println ("Enter name of product to modify" );
91
102
productName = sc .next ();
92
- a1 .Modify (productName , takeIntInput (), takeIntInput ());
103
+ System .out .println ("Enter product's new price" );
104
+ int price = takeIntInput ();
105
+ System .out .println ("Enter product's new no of available units" );
106
+ int UnitsAvail = takeIntInput ();
107
+ a1 .Modify (productName , price , UnitsAvail );
93
108
94
109
break ;
95
110
@@ -106,17 +121,26 @@ else if (opt == 2){
106
121
int fl = 1 ;
107
122
Customer m1 = new Customer (0 , db1 );
108
123
while (fl == 1 ) {
124
+ System .out .println ("Customer\n " +
125
+ " a. Add funds (assume all integer operations)\n " +
126
+ " b. Add product to the cart\n " +
127
+ " c. Check-out cart\n " +
128
+ " d. Exit as Customer" );
129
+ // System.out.println("Enter Option");
109
130
String opType = sc .next ();
110
131
switch (opType ) {
111
132
case "a" :
133
+ System .out .println ("Enter funds to add" );
112
134
int ToAdd = takeIntInput ();
113
135
m1 .incfunds (ToAdd );
114
136
115
137
break ;
116
138
case "b" :
139
+ System .out .println ("Enter product's name" );
117
140
String ProdName = sc .next ();
118
-
119
- m1 .addProduct (ProdName , takeIntInput ());
141
+ System .out .println ("Enter product's quantity" );
142
+ int quantity = takeIntInput ();
143
+ m1 .addProduct (ProdName , quantity );
120
144
121
145
break ;
122
146
case "c" :
0 commit comments