Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class P01ExampBasic2018 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int doughQuantity = Integer.parseInt(scanner.nextLine());
- int weightPerBread = Integer.parseInt(scanner.nextLine());
- double breadCost = Double.parseDouble(scanner.nextLine());
- int countSoldBreads = Integer.parseInt(scanner.nextLine());
- int countSoldSweets = Integer.parseInt(scanner.nextLine());
- double dailyWin = countSoldBreads * breadCost;
- double usedDoughBread = countSoldBreads * weightPerBread;
- double sweetCost = breadCost * 1.25;
- double sweetWeight = (double)weightPerBread * 0.80;
- double usedDoughSweets = countSoldSweets * sweetWeight;
- double nightWin = countSoldSweets * sweetCost;
- double totalDoughCost = ((double) doughQuantity / 1000 + usedDoughBread / 1000) * 4;
- double pureIncoming = (dailyWin + nightWin) - totalDoughCost;
- double totalUsedDough = usedDoughBread + usedDoughSweets;
- totalUsedDough = Math.round(totalUsedDough);
- System.out.println(String.format("Pure income: %.2f lv.%n" +
- "Dough used: %.0f g.", pureIncoming, totalUsedDough));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement