-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStore.java
More file actions
23 lines (19 loc) · 705 Bytes
/
Copy pathStore.java
File metadata and controls
23 lines (19 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class Store {
// instance fields
String productType;
int inventoryCount;
double inventoryPrice;
// constructor method
public Store(String product, int count, double price) {
productType = product;
inventoryCount = count;
inventoryPrice = price;
}
// main method
public static void main(String[] args) {
Store lemonadeStand = new Store("lemonade", 42, .99);
Store cookieShop = new Store("cookies", 12, 3.75);
System.out.println("Our first shop sells " + lemonadeStand.productType + " at " + lemonadeStand.inventoryPrice + " per unit.");
System.out.println("Our second shop has " + cookieShop.inventoryCount + " units remaining.");
}
}