galinyotsev123

ProgBasicsExam28and29July2018-E02footballKit

Dec 28th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E02footballKit {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double tshirtPrice = Double.parseDouble(scanner.nextLine());
  8. double target = Double.parseDouble(scanner.nextLine());
  9.  
  10. double shortsPrice = tshirtPrice * 0.75;
  11. double socksPrice = shortsPrice * 0.20;
  12. double shoesPrice = (shortsPrice + tshirtPrice) * 2;
  13.  
  14. double TOTAL = (tshirtPrice + shortsPrice + socksPrice + shoesPrice)
  15. - ((tshirtPrice + shortsPrice + socksPrice + shoesPrice) * 0.15);
  16.  
  17. double diff = Math.abs(target - TOTAL);
  18.  
  19. if (TOTAL > target) {
  20. System.out.printf("Yes, he will earn the world-cup replica ball!%nHis sum is %.2f lv.", TOTAL);
  21. } else {
  22. System.out.printf("No, he will not earn the world-cup replica ball.%nHe needs %.2f lv. more.", diff);
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment