veronikaaa86

01. Easter Lunch

Apr 9th, 2022 (edited)
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package examPreparation;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01EasterLunch {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int sweetBreadCount = Integer.parseInt(scanner.nextLine());
  10. int eggsCount = Integer.parseInt(scanner.nextLine());
  11. int cookiesCount = Integer.parseInt(scanner.nextLine());
  12.  
  13. double priceSweetBread = sweetBreadCount * 3.20;
  14. double eggsPrice = eggsCount * 4.35;
  15. double cookiesPrice = cookiesCount * 5.40;
  16. double paintEgsPrice = eggsCount * 12 * 0.15;
  17.  
  18. double totalPrice = priceSweetBread + eggsPrice + cookiesPrice + paintEgsPrice;
  19.  
  20. System.out.printf("%.2f", totalPrice);
  21. }
  22. }
  23.  
Add Comment
Please, Sign In to add comment