Using this small program to explain about the OOP.
To run the program, please read the follow:
- Java 1.17
- Show cash
- Add product
- Add stock
- Set product as expired
- Show inventory
- Sale products
- Show sales
git clone
run file main.Shop.java
classDiagram
class Shop{
-Amount cash
-ArrayList~Product~ inventory
-ArrayList~Sale~ sales
+main() void
+loadInventory() void
+showCash() void
+addProduct() void
+addStock() void
+setExpired() void
+showInventory() void
+sale() void
+showSales() void
+addProduct(Product product) void
+isInventoryFull() boolean
+findProduct(String name) Product
}
class Product{
-int id
-String name
-Amount publicPrice
-Amount wholesalerPrice
-boolean available
-int stock
-int totalProducts$
expire() void
}
class Sale{
-String client
-ArrayList~Product~ products
-Amount amount
}
class Amount{
-double value
-String currency
}