Advertisement
veronikaaa86

01. Easter Lunch

Jun 24th, 2023
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package examPrep;
  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 cakeCount = Integer.parseInt(scanner.nextLine());
  10.         int eggsCount = Integer.parseInt(scanner.nextLine());
  11.         int cookiesCount = Integer.parseInt(scanner.nextLine());
  12.  
  13.         double cakePrice = cakeCount * 3.20;
  14.         double eggsPrice = eggsCount * 4.35;
  15.         double cookiesPrice = cookiesCount * 5.40;
  16.         double paintEggsPrice = eggsCount * 12 * 0.15;
  17.  
  18.         double totalSum = cakePrice + eggsPrice + cookiesPrice + paintEggsPrice;
  19.  
  20.         System.out.printf("%.2f", totalSum);
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement