Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package model;
- import java.util.HashMap;
- import java.util.Map.Entry;
- public class MainApp {
- static ProductGroup bottle = new ProductGroup("Bottle", Unit.CL);
- static ProductGroup glass = new ProductGroup("Glass", Unit.GLASS);
- static Product product = new Product("name", 69, bottle);
- static Price price = new Price(product, 96);
- static SalesSituation bar = new SalesSituation("Bar");
- static SalesSituation store = new SalesSituation("Store");
- public static void main(String[] args) {
- HashMap<String, Integer> inner = new HashMap<>();
- HashMap<String, HashMap<String, Integer>> map = new HashMap<>();
- Product p1 = new Product("Georgia Brown Ale", 60, bottle);
- Product p2 = new Product("Easter Brew", 60, bottle);
- Product p3 = new Product("Christmas Pale Ale", 60, glass);
- Product p4 = new Product("Classic", 60, glass);
- Product p5 = new Product("Newcastle", 60, glass);
- inner.put(bar.getName(), Price.getPrice());
- inner.put(store.getName(), Price.getPrice());
- map.put(p1.getName(), inner);
- map.put(p2.getName(), inner);
- map.put(p3.getName(), inner);
- map.put(p4.getName(), inner);
- map.put(p5.getName(), inner);
- for (Entry<String, HashMap<String, Integer>> m : map.entrySet()) {
- System.out.println("Product: " + map.keySet() + " " + "SalesSituation: " + inner.keySet() + " " + "Price: " + inner.values());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement