Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CharityCampaign {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int daysCampaign = Integer.parseInt(scanner.nextLine());
- int bakers = Integer.parseInt(scanner.nextLine());
- int cakes = Integer.parseInt(scanner.nextLine());
- int waffles = Integer.parseInt(scanner.nextLine());
- int pancakes = Integer.parseInt(scanner.nextLine());
- double cakesProfit = cakes * 45;
- double wafflesProfit = waffles * 5.80;
- double pancakesProfit = pancakes * 3.20;
- double profitPerDayByOneBaker = cakesProfit + wafflesProfit + pancakesProfit;
- double profitPerDayByAllBakers = profitPerDayByOneBaker * 8;
- double totalProfit = profitPerDayByAllBakers * daysCampaign;
- double expenses = totalProfit / 1/8;
- double finalProfit = totalProfit - expenses;
- System.out.printf("%.2f", finalProfit);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement