Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exam7January2018;
- import java.util.Scanner;
- public class P01_Bakery {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int startDough = Integer.parseInt(scanner.nextLine());
- int oneBreadWeight = Integer.parseInt(scanner.nextLine());
- double priceBread = Double.parseDouble(scanner.nextLine());
- int sellBreads = Integer.parseInt(scanner.nextLine());
- int sellSweets = Integer.parseInt(scanner.nextLine());
- double total = sellBreads * priceBread;
- double needed = sellBreads * oneBreadWeight;
- double priceSweat = priceBread * 1.25;
- double weightSmall = 0.8 * oneBreadWeight;
- double dough = sellSweets * weightSmall;
- double nightIncome = sellSweets * priceSweat;
- double totalDough = (startDough / 1000.0 + needed / 1000.0) * 4.0;
- double income = total + nightIncome - totalDough;
- double allDough = needed + dough;
- System.out.printf("Pure income: %.2f lv.%n", income);
- System.out.printf("Dough used: %.0f g.", allDough);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement