Advertisement
Guest User

Untitled

a guest
Sep 20th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. package HomeWork;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class CharityCampaign {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. // Вход
  9. int dayOfCampaign = Integer.parseInt(scanner.nextLine());
  10. int numberOfConfectioner = Integer.parseInt(scanner.nextLine());
  11. int countOfCakes = Integer.parseInt(scanner.nextLine());
  12. int countOfWaffles = Integer.parseInt(scanner.nextLine());
  13. int countOfPancakes = Integer.parseInt(scanner.nextLine());
  14. // Пресмятане
  15. double cakePrice = 45.00;
  16. double wafflePrice = 5.8;
  17. double panCakePrice = 3.2;
  18.  
  19. double earnedPerChefForDayCakes = countOfCakes * cakePrice;
  20. double earnedPerChefForDayWaffles = countOfWaffles * wafflePrice;
  21. double earnedPerChefForDayPanCakes = countOfPancakes * panCakePrice;
  22. double totalPriceAllChefs = (earnedPerChefForDayCakes + earnedPerChefForDayPanCakes + earnedPerChefForDayWaffles) * 8;
  23. double moneyEarnedEntireCampaign = totalPriceAllChefs * dayOfCampaign;
  24. double amountAfterCoveringTheCosts = moneyEarnedEntireCampaign - (moneyEarnedEntireCampaign / numberOfConfectioner);
  25. // Принт
  26. System.out.printf("%.2f", amountAfterCoveringTheCosts);
  27. }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement