SHARE
TWEET

main

a guest Oct 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package healthyHeaven;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.     public static void main(String[] args) {
  7.         Scanner sc = new Scanner(System.in);
  8.  
  9.         // Initialize the repository
  10.         Restaurant restaurant = new Restaurant("Casa Domingo");
  11.  
  12. // Initialize the entities
  13.         Vegetable tomato = new Vegetable("Tomato", 20);
  14.         Vegetable cucumber = new Vegetable("Cucumber", 15);
  15.  
  16.         Salad salad = new Salad("Tomatoes with cucumbers");
  17.  
  18.         salad.add(tomato);
  19.         salad.add(cucumber);
  20.  
  21.         System.out.println(salad.getTotalCalories()); // 35
  22.         System.out.println(salad.getProductCount());  // 2
  23.  
  24.         System.out.println(salad.toString());
  25. // * Salad Tomatoes with cucumbers is 35 calories and have 2 products:
  26. //  - Tomato have 20 calories
  27. //  - Cucumber have 15 calories
  28.         restaurant.add(salad);
  29.  
  30.         System.out.println(restaurant.buy("Invalid salad")); // false
  31.  
  32. // Initialize the second entities
  33.         Vegetable corn = new Vegetable("Corn", 90);
  34.         Salad casaDomingo = new Salad("Casa Domingo");
  35.  
  36.         casaDomingo.add(tomato);
  37.         casaDomingo.add(cucumber);
  38.         casaDomingo.add(corn);
  39.  
  40.         restaurant.add(casaDomingo);
  41.  
  42.         System.out.println(restaurant.getHealthiestSalad()); // Tomatoes with cucumbers
  43.  
  44.         System.out.println(restaurant.generateMenu());
  45. // Casa Domingo have 2 salads:
  46. // * Salad Tomatoes with cucumbers is 35 calories and have 2 products:
  47. //  - Tomato have 20 calories
  48. //  - Cucumber have 15 calories
  49. // * Salad Casa Domingo is 125 calories and have 3 products:
  50. //  - Tomato have 20 calories
  51. //  - Cucumber have 15 calories
  52. //  - Corn have 90 calories
  53.  
  54.     }
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top