Ligh7_of_H3av3n

02. Football Kit

Oct 15th, 2023
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. package SamiqtIzpit;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P02 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double tshirtPrice = Double.parseDouble(scanner.nextLine());
  10.         double sum = Double.parseDouble(scanner.nextLine());
  11.  
  12.         double shortsPrice = tshirtPrice * 0.75;
  13.         double socksPrice = shortsPrice * 0.20;
  14.         double shoesPrice = (tshirtPrice + shortsPrice)* 2;
  15.  
  16.  
  17.         double totalPrice = (tshirtPrice + shortsPrice + socksPrice + shoesPrice);
  18.         double discout = totalPrice * 0.15;
  19.         double discountedPrice = (totalPrice - discout);
  20.         double moneyNeeded = (sum - discountedPrice);
  21.  
  22.         if (discountedPrice >= sum){
  23.             System.out.println("Yes, he will earn the world-cup replica ball!");
  24.             System.out.printf("His sum is %.2f lv.", discountedPrice);
  25.         }
  26.         else {
  27.             System.out.println("No, he will not earn the world-cup replica ball.");
  28.             System.out.printf("He needs %.2f lv. more.", moneyNeeded);
  29.         }
  30.  
  31.  
  32.  
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment