-
Notifications
You must be signed in to change notification settings - Fork 0
/
KeychainsRealUltimatePower.java
145 lines (129 loc) · 4.43 KB
/
KeychainsRealUltimatePower.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
134
135
136
137
138
139
140
141
142
143
144
145
import java.util.Scanner;
public class KeychainsRealUltimatePower
{
public static int realitem,man;
Scanner input=new Scanner(System.in);
public static int add_keychains()
{
Scanner keyboard =new Scanner(System.in);
int item;
//int realitem;
System.out.printf("How many keychains should be added%n");
realitem = keyboard.nextInt();
System.out.printf("You now have %d%n",realitem);
System.out.printf("1)ADD KEYCHAIN%n2)REMOVE KEYCHAIN%n3)VIEW CART%n4)CHECKOUT");
System.out.printf("%nPlease choose an option");
item = keyboard.nextInt();
if(item==1)
{
add_keychains();
}
else if(item==2)
{
remove_keycahin();
}
else if(item==3)
{
view_cart();
}
else if(item==4)
{
checkout();
}
else
{
System.out.println("Error");
}
return realitem;
}
public static int remove_keycahin()
{
Scanner keyboard =new Scanner(System.in);
int item;
System.out.println("how many keychains should be removed ?");
int del=keyboard.nextInt();
man=realitem-del;
System.out.printf("You now have %d keychains%n",man);
System.out.printf("1)ADD KEYCHAIN%n2)REMOVE KEYCHAIN%n3)VIEW CART%n4)CHECKOUT");
System.out.printf("%nPlease choose an option");
item = keyboard.nextInt();
if(item==1)
{
add_keychains();
}
else if(item==2)
{
remove_keycahin();
}
else if(item==3)
{
view_cart();
}
else if(item==4)
{
checkout();
}
return man;
}
public static void view_cart()
{
Scanner keyboard = new Scanner(System.in);
int item;
System.out.printf("You now have %d keychains%n",man);
man=man*10;
System.out.printf("Each keychain is 10 cedis.%n Your total therefore is %d cedis ",man);
System.out.printf("1)ADD KEYCHAIN%n2)REMOVE KEYCHAIN%n3)VIEW CART%n4)CHECKOUT");
System.out.printf("%nPlease choose an option");
item = keyboard.nextInt();
if(item==1)
{
add_keychains();
}
else if(item==2)
{
remove_keycahin();
}
else if(item==3)
{
view_cart();
}
else if(item==4)
{
checkout();
}
}
public static void checkout()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("CHECKOUT");
System.out.println("What is your name?");
String v = keyboard.next();
System.out.printf("Each keychain is 10 cedis.%n Your total therefore is %d cedis%n ",man);
System.out.printf("Thank ypu for your order, %s.",v);
}
public static void main(String[] arg)
{
System.out.println("THE C3NTYN3NTC3NTYN3L's SHOPPINGMALL");
Scanner keyboard =new Scanner(System.in);
int item;
System.out.printf("1)ADD KEYCHAIN%n2)REMOVE KEYCHAIN%n3)VIEW CART%n4)CHECKOUT");
System.out.printf("%nPlease choose an option");
item = keyboard.nextInt();
if(item==1)
{
add_keychains();
}
else if(item==2)
{
remove_keycahin();
}
else if(item==3)
{
view_cart();
}
else if(item==4)
{
checkout();
}
}
}