Advertisement
IvaAnd

CharityCompaign

Feb 11th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CarityCompaign {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         //1. read how many days
  8.         //2. number of Chefs
  9.         //3. number of cakes prepared per 1 Chef perr 1 day
  10.         //4. number of wafels prepared per Chef per 1 day
  11.         //5. number of pancakes prepared per 1 Chef per 1 day
  12.         //6. price list - 1 cake = 45lv., 1 wafel = 5.80lv., 1 pancake = 3.20lv.
  13.         //7.  1/8 of the total amount is covering the product costs
  14.         //8.  Write the remaining amount -> to be donated round off %.2f
  15.  
  16.         int numberOfDays = Integer.parseInt (scanner.nextLine());
  17.         int numberOfChefs = Integer.parseInt (scanner.nextLine());
  18.         int numberOfcakesPCPD = Integer.parseInt (scanner.nextLine());
  19.         int numberOfwafelsPCPD = Integer.parseInt (scanner.nextLine());
  20.         int numberOfPancakesPCPD = Integer.parseInt (scanner.nextLine());
  21.         double totalPriceOfCakes = numberOfDays * numberOfChefs * numberOfcakesPCPD * 45;
  22.         double totalPriceOfWafels = numberOfDays * numberOfChefs * numberOfwafelsPCPD * 5.80;
  23.         double totalPriceOfPancakes = numberOfDays * numberOfChefs * numberOfPancakesPCPD * 3.20;
  24.         double grandTotalOfSweets = ( totalPriceOfCakes + totalPriceOfPancakes + totalPriceOfWafels );
  25.         double totalToDoante = grandTotalOfSweets - ( grandTotalOfSweets * 0.125);
  26.  
  27.         System.out.printf("%.2f", totalToDoante);
  28.  
  29.  
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement