Advertisement
yovkovbpfps

Simple Operation and Calculation Charity Campaing

Apr 19th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Greeting {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int days = Integer.parseInt(scanner.nextLine());
  8. int bakers = Integer.parseInt(scanner.nextLine());
  9. int cakes = Integer.parseInt(scanner.nextLine());
  10. int waffles = Integer.parseInt(scanner.nextLine());
  11. int pancakes = Integer.parseInt(scanner.nextLine());
  12.  
  13. int cakesPrice = cakes * 45;
  14. double wafflesPrice = waffles * 5.80;
  15. double pancakesPrice = pancakes * 3.20;
  16. double priceForDay = (cakesPrice + wafflesPrice + pancakesPrice) * bakers;
  17. double campaignSum = priceForDay * days;
  18. double finalSum = campaignSum * 0.875;
  19.  
  20. System.out.printf("%.2f",finalSum);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement