Advertisement
uktcar

01.2.06CharityCampaign

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