-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventoryManagement.java
More file actions
77 lines (60 loc) · 2.24 KB
/
InventoryManagement.java
File metadata and controls
77 lines (60 loc) · 2.24 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
package inventoryManagement;
import java.util.Scanner;
public class InventoryManagement {
public static void main(String[] args) {
//Variable declaration
int numSoda = 100;
int numChips = 40;
int numCandy = 60;
int restockSoda = 40;
int restockChips = 20;
int restockCandy = 40;
int sodaSold;
int chipsSold;
int candySold;
Scanner sc = new Scanner(System.in);
//Intro message
System.out.println("Hello! Welcome to the restocking tool!");
System.out.println("How many sodas have been sold today? The stock is " + numSoda);
sodaSold = sc.nextInt();
/*If the amount of sodas sold exceeds the numbers of Soda available in stock, display error message
and do not calculate */
if (sodaSold > numSoda) {
System.out.println("The number " + sodaSold + " is too high. Stock value not adjusted");
} else {
numSoda = numSoda - sodaSold;
System.out.println("There are " + numSoda + " sodas left");
}
//Repeat for Chips sold
System.out.println("How many chips have been sold today? The stock is " + numChips);
chipsSold = sc.nextInt();
if (chipsSold > numChips) {
System.out.println("The number " + chipsSold + " is too high. Stock value not adjusted");
} else {
numChips = numChips - chipsSold;
System.out.println("There are " + numChips + " chips left");
}
//Repeat for number of Candy sold
System.out.println("How much candy has been sold today? The stock is " + numCandy);
candySold = sc.nextInt();
if(candySold > numCandy) {
System.out.println("The number " + candySold + " is too high. Stock value not adjusted");
} else {
numCandy = numCandy - candySold;
System.out.println("There are " + numCandy + " candy left");
}
System.out.println("Thank you! Based on your input, these need to be restocked: ");
/* If number of product remaining is less than the restock threshold, display a message
indicating the product needs to be restocked */
if(numSoda <= restockSoda) {
System.out.println("Soda needs to be restocked");
}
if(numChips <= restockChips) {
System.out.println("Chips need to be restocked");
}
if(numCandy <= restockCandy) {
System.out.println("Candy needs to be restocked");
System.out.println("Good bye!");
}
}
}