Advertisement
Ivelin_1936

Untitled

Feb 1st, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01ExampBasic2018 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int doughQuantity = Integer.parseInt(scanner.nextLine());
  10.         int weightPerBread  = Integer.parseInt(scanner.nextLine());
  11.         double breadCost = Double.parseDouble(scanner.nextLine());
  12.         int countSoldBreads = Integer.parseInt(scanner.nextLine());
  13.         int countSoldSweets = Integer.parseInt(scanner.nextLine());
  14.  
  15.         double dailyWin = countSoldBreads * breadCost;
  16.         double usedDoughBread = countSoldBreads * weightPerBread;
  17.         double sweetCost = breadCost * 1.25;
  18.         double sweetWeight = (double)weightPerBread * 0.80;
  19.         double usedDoughSweets = countSoldSweets * sweetWeight;
  20.         double nightWin = countSoldSweets * sweetCost;
  21.         double totalDoughCost = ((double) doughQuantity / 1000 + usedDoughBread / 1000) * 4;
  22.         double pureIncoming = (dailyWin + nightWin) - totalDoughCost;
  23.         double totalUsedDough = usedDoughBread + usedDoughSweets;
  24.  
  25.         totalUsedDough = Math.round(totalUsedDough);
  26.  
  27.         System.out.println(String.format("Pure income: %.2f lv.%n" +
  28.                 "Dough used: %.0f g.", pureIncoming, totalUsedDough));
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement