Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CarityCompaign {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- //1. read how many days
- //2. number of Chefs
- //3. number of cakes prepared per 1 Chef perr 1 day
- //4. number of wafels prepared per Chef per 1 day
- //5. number of pancakes prepared per 1 Chef per 1 day
- //6. price list - 1 cake = 45lv., 1 wafel = 5.80lv., 1 pancake = 3.20lv.
- //7. 1/8 of the total amount is covering the product costs
- //8. Write the remaining amount -> to be donated round off %.2f
- int numberOfDays = Integer.parseInt (scanner.nextLine());
- int numberOfChefs = Integer.parseInt (scanner.nextLine());
- int numberOfcakesPCPD = Integer.parseInt (scanner.nextLine());
- int numberOfwafelsPCPD = Integer.parseInt (scanner.nextLine());
- int numberOfPancakesPCPD = Integer.parseInt (scanner.nextLine());
- double totalPriceOfCakes = numberOfDays * numberOfChefs * numberOfcakesPCPD * 45;
- double totalPriceOfWafels = numberOfDays * numberOfChefs * numberOfwafelsPCPD * 5.80;
- double totalPriceOfPancakes = numberOfDays * numberOfChefs * numberOfPancakesPCPD * 3.20;
- double grandTotalOfSweets = ( totalPriceOfCakes + totalPriceOfPancakes + totalPriceOfWafels );
- double totalToDoante = grandTotalOfSweets - ( grandTotalOfSweets * 0.125);
- System.out.printf("%.2f", totalToDoante);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement