12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
-
- /**
- * Created by leon on 1/10/18.
- */
- public class MainApplication {
-
- public static void main(String[] args) {
- System.out.println("This is a quick inventory demo!");
-
- Inventory starkStuff = new Inventory();
- System.out.println("We can create a new inventory for Rickon Stark's new store, Stark Stuff!");
-
- starkStuff.addItem(3.00f, 9, "direwolf collar");
- System.out.println("We added an invetory item called " + starkStuff.getItem("direwolf collar").getID());
- System.out.println("The price is: " + starkStuff.getPrice("direwolf collar"));
- System.out.println("The quanitity is: " + starkStuff.getOnHandQuantity("direwolf collar"));
-
- starkStuff.addItem(2.50f, 5, "direwolf treat");
- starkStuff.addItem(2.99f, 6, "winterfell snowglobe");
-
- System.out.println(String.format("There are also %d direwolf treats that cost $%.2f.",
- starkStuff.getOnHandQuantity("direwolf treat"), starkStuff.getPrice("direwolf treat")));
-
- System.out.println(String.format("There are also %d winterfell snowglobes that cost $%.2f.",
- starkStuff.getOnHandQuantity("winterfell snowglobe"), starkStuff.getPrice("winterfell snowglobe")));
-
- starkStuff.updatePrice("winterfell snowglobe", 199.99f);
- System.out.println("But wait!");
- System.out.println("After Jon Snow returned to Winterfell, the demand for winterfell snowglobes shot way up!");
- System.out.println("Rickon decides to up the price. (sadly, he must do this from beyond the grave)");
- System.out.println(String.format("The new price of winterfell snowglobes is: $%.2f", starkStuff.getPrice("winterfell snowglobe")));
-
- starkStuff.removeUnits("direwolf treat", 3);
- System.out.println("With Jon Snow's direwolf Ghost around, the direwolf treats are selling fast.");
- System.out.println(String.format("The new on hand quantity for direwolf treats is: %d", starkStuff.getOnHandQuantity("direwolf treat")));
-
- starkStuff.addUnits("winterfell snowglobe", 15);
-
- System.out.println("Luckily there is a new shipment of winterfell snowglobe.");
- System.out.println(String.format("The new on hand quantity for winterfell snowglobes is: %d", starkStuff.getOnHandQuantity("winterfell snowglobe")));
-
- double inVal = starkStuff.getInventoryValue();
-
- System.out.println(String.format("Now, the total value of the late Rickon Stark's inventory is: $%.2f", inVal));
-
- }
- }
-
-
-
-
|