-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventory.java
More file actions
221 lines (156 loc) · 5.61 KB
/
Inventory.java
File metadata and controls
221 lines (156 loc) · 5.61 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
package Ass1;
import java.util.ArrayList;
public class Inventory{
// total price
double total_a;
double total_b;
double total_p;
double total_c;
double total_cc;
//stock
String input ="";
int minus = 0;
private int apple_stock = 1000 - minus;
private int item_ID_a = 101;
private double item_price_a = 2.00;
private String item_des_a ="Apple";
private int banana_stock = 1000 - minus;
private int item_ID_b = 102;
private double item_price_b = 0.99;
private String item_des_b ="Banana";
private int pop_stock = 2000 - minus;
private int item_ID_p = 203;
private double item_price_p = 2.00;
private String item_des_p ="Coke 2L bottle";
private int chips_stock = 2000- minus;
private int item_ID_c = 200;
private double item_price_c = 1.50;
private String item_des_c ="Chips";
//create new inventory
// for test don't need this
//Inventory I1 = new Inventory();
public Inventory()
{
// implicit call to Object constructor occurs here
}
public Inventory(int minus_t, int apple_stock_t)
{
// implicit call to Object constructor occurs here
minus = minus_t; // no need for validation
apple_stock = apple_stock_t; // no need for validation
}
//stock methods
public void get_apple_stock(){
System.out.println("The apple stock is" +apple_stock);
System.out.println("\n");
}
public void get_banana_stock(){
System.out.println("The banana stock is" +banana_stock);
System.out.println("\n");
}
public void get_pop_stock(){
System.out.println("The pop stock is" +pop_stock);
System.out.println("\n");
}
public void get_chip_stock(){
System.out.println("The chips stock is" +chips_stock);
System.out.println("\n");
}
//pruchasing minus stock methods
public void minus_stock_apple(int minus){
apple_stock = apple_stock - minus;
System.out.println("The new stock after purchase is" +apple_stock);
System.out.println("\n");
}
public void minus_stock_banana(int minus){
banana_stock = banana_stock - minus;
System.out.println("The new stock after purchase is" +banana_stock);
System.out.println("\n");
}
public void minus_stock_pop(int minus){
pop_stock = pop_stock - minus;
System.out.println("The new stock after purchase is" +pop_stock);
System.out.println("\n");
}
public void minus_stock_chips(int minus){
chips_stock = chips_stock - minus;
System.out.println("The new stock after purchase is" +chips_stock);
System.out.println("\n");
}
// price methods
public double get_apple_price(int minus, double total_a){
total_a = item_price_a * (double)minus;
System.out.println("The apple price is $\t" +item_price_a);
System.out.println("\n");
System.out.println("With the total apples you are purchasing \t" +minus);
System.out.println("\n");
System.out.println("The total is $ \t" +total_a);
System.out.println("\n");
return this.total_a = total_a;
}
public double get_banana_price(int minus, double total_b){
total_b = item_price_b * (double)minus;
System.out.println("The apple price is $\t" +item_price_b);
System.out.println("\n");
System.out.println("With the total apples you are purchasing \t" +minus);
System.out.println("\n");
System.out.println("The total is $ \t" +total_b);
System.out.println("\n");
return this.total_b = total_b;
}
public double get_pop_price(int minus, double total_p){
total_p = item_price_p * (double)minus;
System.out.println("The apple price is $\t" +item_price_p);
System.out.println("\n");
System.out.println("With the total apples you are purchasing \t" +minus);
System.out.println("\n");
System.out.println("The total is $ \t" +total_p);
System.out.println("\n");
//Price pp1 = new Price();
//pp1.store_p(total_p);
return this.total_p = total_p;
}
public double get_chips_price(int minus, double total_c){
total_c = item_price_c * (double)minus;
System.out.println("The apple price is $\t" +item_price_c);
System.out.println("\n");
System.out.println("With the total apples you are purchasing \t" +minus);
System.out.println("\n");
System.out.println("The total is $ \t" +total_c);
System.out.println("\n");
//Price c1 = new Price();
//c1.store_c(total_c);
return this.total_c = total_c;
//set_chips_price(total_c);
//return total_cc = total_c;
}
public double set_chips_price(double total_cc){
System.out.println("Total C is" +total_cc);
return this.total_cc = total_c;
}
//total price
public void total_purchase_price(double total_a, double total_b, double total_p, double total_c){
double full_total, before_tax_total, tax = 0.15;
int sub_exit = 0, sum = 0;
double[] subtotal = null;
// testing
System.out.println("apple total is" +total_a);
System.out.println("banana total is" +total_b);
System.out.println("pop total is" +total_p);
System.out.println("chips total is" +total_cc);
System.out.println("\n");
before_tax_total = total_a + total_b + total_p + total_c;
//display total before tax
System.out.println("The sub total is $\t" +before_tax_total);
//other way of doing it
double s;
//s = before_tax_total;
//display the tax
System.out.println("\n");
System.out.println("The tax right now is \t" +tax);
System.out.println("\n");
//display the final total
full_total = before_tax_total + (tax * before_tax_total);
System.out.println("The final total after tax being applied is $\t" +full_total);
}
}