Guest User

Untitled

a guest
Mar 11th, 2020
239
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package E04_PizzaCalories;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7.  
  8. Scanner scanner = new Scanner(System.in);
  9. String[] pizzaLine = scanner.nextLine().split("\\s+");
  10. String pizzaName = pizzaLine[1];
  11. int numberOfToppings = Integer.parseInt(pizzaLine[2]);
  12. Pizza pizza = new Pizza(pizzaName, numberOfToppings);
  13.  
  14. String[] doughLine = scanner.nextLine().split("\\s+");
  15. String flourType = doughLine[1];
  16. String bakingTechnique = doughLine[2];
  17. double weight = Double.parseDouble(doughLine[3]);
  18. Dough dough = new Dough(flourType, bakingTechnique, weight);
  19.  
  20. String input;
  21. while (!"END".equals(input = scanner.nextLine())){
  22. String[] tokens = input.split("\\s+");
  23. String toppingType = tokens[1];
  24. double weightt = Double.parseDouble(tokens[2]);
  25.  
  26. Topping topping = new Topping(toppingType, weightt);
  27. pizza.addTopping(topping);
  28.  
  29. }
  30. System.out.println(pizza.getOverallCalories());
  31.  
  32. }
  33. }
RAW Paste Data