Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CharityCampaign_06 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- //приходи торти = бр.торти * цена за 1 торта
- //приходи гофрети = бр.гофрети * цена за 1 гофрета
- //приходи палачинки = бр.палачинки * цена за 1 палачинка
- //печалба за един ден за всички сладкари = (приходи торти + приходи гофрети + пари палачинки) * пекари
- //печалба за всички дни = печалба за един ден за всички сладкари * дни
- int days = Integer.parseInt(scanner.nextLine());
- int bakers = Integer.parseInt(scanner.nextLine());
- int countCakes = Integer.parseInt(scanner.nextLine());
- int countWaffles = Integer.parseInt(scanner.nextLine());
- int countPancakes = Integer.parseInt(scanner.nextLine());
- double incomeCakes = countCakes * 45;
- double incomeWaffles = countWaffles * 5.80;
- double incomePancakes = countPancakes * 3.20;
- double incomePerDay = (incomeCakes + incomeWaffles + incomePancakes) * bakers;
- double incomePerCampaign = days * incomePerDay;
- double finalSum = incomePerCampaign - incomePerCampaign / 8;
- System.out.printf("%.2f", finalSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement