Advertisement
WindFell

Charity Campaign Java

Sep 10th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CharityCompagn{
  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 countCakes = cakes * 45;
  14.         double countWaffles = waffles * 5.8;
  15.         double countPancakes = pancakes * 3.2;
  16.  
  17.         double sum = (countCakes + countWaffles + countPancakes);
  18.         double allCampaign = sum * days * bakers;
  19.  
  20.         double costs = (allCampaign /8) * 7;
  21.  
  22.         System.out.printf("%.2f",costs);
  23.  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement