Advertisement
mtsonkova

Untitled

Feb 19th, 2023
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class footBallEquipment {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double shirtPrice = Double.parseDouble(scanner.nextLine());
  8. double targetPrice = Double.parseDouble(scanner.nextLine());
  9. double discount = 0.15;
  10.  
  11. //shorts, socks, shoes
  12. double shortsPrice = shirtPrice * 0.75;
  13. double socksPrice = shortsPrice * 0.2;
  14. double shoesPrice = 2 * (shortsPrice + shirtPrice);
  15. double finalPrice = shirtPrice + shortsPrice + socksPrice + shoesPrice;
  16. double discountedPrice = finalPrice - (finalPrice * 0.15);
  17.  
  18. if(discountedPrice >= targetPrice) {
  19. System.out.println("Yes, he will earn the world-cup replica ball!");
  20. System.out.printf("His sum is %.2f lv.", discountedPrice);
  21. } else {
  22. double neededMoney = targetPrice - discountedPrice;
  23. System.out.println("No, he will not earn the world-cup replica ball.");
  24. System.out.printf("He needs %.2f lv. more.", neededMoney);
  25. }
  26. }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement