Advertisement
myrdok123

08. Basketball Equipment

Jan 7th, 2024
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. package W01FirstStepsInCoding.Exercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P08BasketballEquipment {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.  
  11.         int feePerYear = Integer.parseInt(scanner.nextLine());
  12.  
  13.         //Пресмятаме цената за кецове, екип, топка, аксесоари
  14.  
  15.         double trainersPrice = feePerYear - feePerYear * 0.40; // feePerYear * 0.60
  16.         double suitPrice = trainersPrice - trainersPrice * 0.20; //trainersPrice * 0.80
  17.         double ballPrice = suitPrice / 4;
  18.         double accessoriesPrice = ballPrice / 5;
  19.  
  20.         // Пресмятаме общата сума за разходи
  21.         // => год. такса + цена за кецове + цена за екип + цена за топка + цена за аксесоари
  22.  
  23.         double finalPrice = feePerYear + trainersPrice + suitPrice + ballPrice + accessoriesPrice;
  24.  
  25.         System.out.println(finalPrice);
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement