yovkovbpfps

EXAM 2-3 MAY 2019 01.Food Delivery

May 6th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Food {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double chicken = 10.35;
  8. double fish = 12.40;
  9. double vegeranian = 8.15;
  10.  
  11.  
  12. int chickenMeal = Integer.parseInt(scanner.nextLine());
  13. int fishMeal = Integer.parseInt(scanner.nextLine());
  14. int vegetarianMeal = Integer.parseInt(scanner.nextLine());
  15.  
  16. double chickenPrice = chickenMeal * chicken;
  17. double fishPrice = fishMeal * fish;
  18. double vegetarianPrice = vegetarianMeal * vegeranian;
  19. double allPrice = chickenPrice + fishPrice + vegetarianPrice;
  20.  
  21. double discount = allPrice * 0.20;
  22. double delivery = 2.50;
  23.  
  24. double Price = discount + allPrice + delivery;
  25.  
  26. System.out.printf("Total: %.2f",Price);
  27.  
  28.  
  29.  
  30.  
  31. }
  32. }
Add Comment
Please, Sign In to add comment