Advertisement
desislava_topuzakova

01.Bakery

Mar 11th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package Exam7January2018;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01_Bakery {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int startDough = Integer.parseInt(scanner.nextLine());
  10. int oneBreadWeight = Integer.parseInt(scanner.nextLine());
  11. double priceBread = Double.parseDouble(scanner.nextLine());
  12. int sellBreads = Integer.parseInt(scanner.nextLine());
  13. int sellSweets = Integer.parseInt(scanner.nextLine());
  14.  
  15. double total = sellBreads * priceBread;
  16. double needed = sellBreads * oneBreadWeight;
  17. double priceSweat = priceBread * 1.25;
  18. double weightSmall = 0.8 * oneBreadWeight;
  19. double dough = sellSweets * weightSmall;
  20. double nightIncome = sellSweets * priceSweat;
  21. double totalDough = (startDough / 1000.0 + needed / 1000.0) * 4.0;
  22. double income = total + nightIncome - totalDough;
  23. double allDough = needed + dough;
  24.  
  25. System.out.printf("Pure income: %.2f lv.%n", income);
  26. System.out.printf("Dough used: %.0f g.", allDough);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement