Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5. public class testSecond {
  6. public static void main(String[] args) throws IOException {
  7. BufferedReader reader =
  8. new BufferedReader(new InputStreamReader(System.in));
  9.  
  10. double total = 0;
  11.  
  12.  
  13. double budget = Float.parseFloat(reader.readLine());
  14. double skiPrice = Float.parseFloat(reader.readLine());
  15. double shtekiPrice = Float.parseFloat(reader.readLine());
  16.  
  17. double skiBoots = skiPrice * 0.4;
  18. double skiWear = skiPrice * 1.4;
  19.  
  20. total = skiPrice + skiBoots + skiWear;
  21. if (total < 800) {
  22. total += shtekiPrice;
  23. }
  24.  
  25. if (total <= budget) {
  26. double left = budget - total;
  27. System.out.printf("Angel's sum is %.2f lv. He has %.2f lv. left.", total, left);
  28. } else {
  29. double needed = total - budget;
  30. System.out.printf("Not enough money! You need %.2f leva more!", needed);
  31. }
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement