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 ден = сума за торти + сума за гофрети + сума за палачинки - ок
- //сума за торти = бр.торти * цена за торта (45лв) - ok
- //сума за гофрети = бр.гофрети * цена за гофрета (5.80) - ok
- //сума за палачинки = бр. палачинки * цена за палачинка(3.20) - ok
- //2. сума за всички сладкари за 1 ден = бр. сладкари * сума на сладкар за 1 ден
- //3. общо за всички дни = сума за всички сладкари за 1 ден * бр. дни
- //4. разходи = 1 / 8 от общо за всички дни
- //5. крайна сума = общо за всички дни - разходи
- int countDays = Integer.parseInt(scanner.nextLine());
- int countBakers = Integer.parseInt(scanner.nextLine());
- int countCakes = Integer.parseInt(scanner.nextLine());
- int countWaffles = Integer.parseInt(scanner.nextLine());
- int countPancakes = Integer.parseInt(scanner.nextLine());
- double priceCakes = countCakes * 45;
- double priceWaffles = countWaffles * 5.80;
- double pricePancakes = countPancakes * 3.20;
- double sumPerBakerForDay = priceCakes + priceWaffles + pricePancakes; //1 сладкар за 1 ден
- double sumAllBakersForDay = sumPerBakerForDay * countBakers;
- double sumAllDays = sumAllBakersForDay * countDays;
- double expenses = sumAllDays / 8;
- double profit = sumAllDays - expenses;
- System.out.printf("%.2f", profit);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement