Advertisement
desislava_topuzakova

06. Charity Campaign

Jun 11th, 2020
1,289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CharityCampaign_06 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         //приходи торти = бр.торти * цена за 1 торта
  7.         //приходи гофрети = бр.гофрети * цена за 1 гофрета
  8.         //приходи палачинки = бр.палачинки * цена за 1 палачинка
  9.         //печалба за един ден за всички сладкари = (приходи торти + приходи гофрети + пари палачинки) * пекари
  10.         //печалба за всички дни = печалба за един ден за всички сладкари * дни
  11.         int days = Integer.parseInt(scanner.nextLine());
  12.         int bakers = Integer.parseInt(scanner.nextLine());
  13.         int countCakes = Integer.parseInt(scanner.nextLine());
  14.         int countWaffles = Integer.parseInt(scanner.nextLine());
  15.         int countPancakes = Integer.parseInt(scanner.nextLine());
  16.  
  17.         double incomeCakes = countCakes * 45;
  18.         double incomeWaffles = countWaffles * 5.80;
  19.         double incomePancakes = countPancakes * 3.20;
  20.  
  21.         double incomePerDay = (incomeCakes + incomeWaffles + incomePancakes) * bakers;
  22.         double incomePerCampaign = days * incomePerDay;
  23.         double finalSum = incomePerCampaign - incomePerCampaign / 8;
  24.  
  25.         System.out.printf("%.2f", finalSum);
  26.  
  27.  
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement