Advertisement
paykova

CharityCompaign

Oct 5th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CharityCompaign {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int days = Integer.parseInt(scanner.nextLine());
  8. int cooks = Integer.parseInt(scanner.nextLine());
  9.  
  10. double cakes = Double.parseDouble(scanner.nextLine());
  11. double waffles = Double.parseDouble(scanner.nextLine());
  12. double pancakes = Double.parseDouble(scanner.nextLine());
  13.  
  14. double result, total, charity, perCook;
  15.  
  16. perCook = cakes*45 + waffles*5.80 + pancakes * 3.20;
  17. result = days*cooks;
  18. total = result * perCook;
  19. charity = total - total/8;
  20.  
  21. System.out.printf("%.2f", charity);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement