Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CharityCampaign {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int daysCampaign = Integer.parseInt(scanner.nextLine());
  7. int bakers = Integer.parseInt(scanner.nextLine());
  8. int cakes = Integer.parseInt(scanner.nextLine());
  9. int waffles = Integer.parseInt(scanner.nextLine());
  10. int pancakes = Integer.parseInt(scanner.nextLine());
  11.  
  12. double cakesProfit = cakes * 45;
  13. double wafflesProfit = waffles * 5.80;
  14. double pancakesProfit = pancakes * 3.20;
  15.  
  16. double profitPerDayByOneBaker = cakesProfit + wafflesProfit + pancakesProfit;
  17. double profitPerDayByAllBakers = profitPerDayByOneBaker * 8;
  18.  
  19. double totalProfit = profitPerDayByAllBakers * daysCampaign;
  20. double expenses = totalProfit / 1/8;
  21. double finalProfit = totalProfit - expenses;
  22. System.out.printf("%.2f", finalProfit);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement