Advertisement
Spocoman

Easter Bakery

Sep 4th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double flourKg = Double.parseDouble(scanner.nextLine()),
  7.                 flourPrice = Double.parseDouble(scanner.nextLine()),
  8.                 sugarKg = Double.parseDouble(scanner.nextLine()),
  9.                 eggPack = Double.parseDouble(scanner.nextLine()),
  10.                 yeast = Double.parseDouble(scanner.nextLine()),
  11.                 flourTotal = flourKg * flourPrice,
  12.                 sugarTotal = flourKg * sugarKg * 0.75,
  13.                 eggPackTotal = flourKg * eggPack * 1.10,
  14.                 yeastTotal = flourKg * 0.75 * yeast * 0.20,
  15.                 totalSum = flourTotal + sugarTotal + eggPackTotal + yeastTotal;
  16.  
  17.         System.out.printf("%.2f\n", totalSum);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement