Advertisement
Guest User

6zadacha

a guest
Mar 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package com.company;
  2. import java.util.Scanner;
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         int days = Integer.parseInt(scanner.nextLine());
  9.         int bakers = Integer.parseInt(scanner.nextLine());
  10.         int cakes = Integer.parseInt(scanner.nextLine());
  11.         int waffles = Integer.parseInt(scanner.nextLine());
  12.         int pancakes = Integer.parseInt(scanner.nextLine());
  13.  
  14.         double cakeProfit = cakes * 45;
  15.         double wafflesProfit = waffles * 5.80;
  16.         double pancakesProfit = pancakes * 3.20;
  17.  
  18.         double profitPerDayByOne = cakeProfit + wafflesProfit + pancakesProfit;
  19.         double profitPerDayAll = profitPerDayByOne * 8;
  20.  
  21.  
  22.         double totalProfits= profitPerDayAll * days;
  23.         double expenses = totalProfits - 1/8 ;
  24.  
  25.         double finalProfit = totalProfits- expenses;
  26.  
  27.         System.out.printf("%.2f", finalProfit);
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement