Advertisement
veronikaaa86

06. Charity Campaign

Jun 7th, 2021
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P06CharityCampaign {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int campaignDays = Integer.parseInt(scanner.nextLine());
  8. int countCook = Integer.parseInt(scanner.nextLine());
  9. int countCakes = Integer.parseInt(scanner.nextLine());
  10. int countWaffles = Integer.parseInt(scanner.nextLine());
  11. int countPancakes = Integer.parseInt(scanner.nextLine());
  12.  
  13. double sumCakes = countCakes * 45.0;
  14. double sumWaffles = countWaffles * 5.80;
  15. double sumPancakes = countPancakes * 3.20;
  16.  
  17. double allCookPerDay = (sumCakes + sumWaffles + sumPancakes) * countCook;
  18. double totalSum = allCookPerDay * campaignDays;
  19.  
  20. double result = totalSum - (totalSum / 8);
  21.  
  22. System.out.printf("%.2f", result);
  23.  
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement