Advertisement
desislava_topuzakova

08. Basketball Equipment

May 8th, 2022
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class BasketballEquipment_08 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         //1. входни данни
  7.         int priceTrainings = Integer.parseInt(scanner.nextLine());
  8.         //2. цена за кецове = цена за тренировки - 40% (0.4)
  9.         double priceTrainers = priceTrainings - 0.4 * priceTrainings; //0.6 * priceTrainings;
  10.         //3. цена за екип = цена за кецове - 20% (0.2)
  11.         double priceSuit = priceTrainers - 0.2 * priceTrainers; //0.8 * priceTrainers;
  12.         //4. цена за топка = 1 /4 от цена за екип
  13.         double priceBall = priceSuit / 4;
  14.         //5. цена за аксесоари = 1 / 5 от цена за топка
  15.         double priceAcc = priceBall / 5;
  16.         //6. разходи = цена за тренировки (входни данни)
  17.         //      + цена за кецове
  18.         //      + цена за топка
  19.         //      + цена за екип
  20.         //      + цена за аксесоари
  21.         double expenses = priceTrainings + priceTrainers + priceBall + priceSuit + priceAcc;
  22.         //7. отпечатваме разходи
  23.         System.out.println(expenses);
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement