Advertisement
desislava_topuzakova

10. Rage Expenses

Jan 15th, 2021
1,080
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class RageExpenses_10 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner (System.in);
  6.         //headset, mouse , keyboard and display
  7.         //разход =
  8.         int lostGames = Integer.parseInt(scanner.nextLine());
  9.         double headsetPrice = Double.parseDouble(scanner.nextLine());
  10.         double mousePrice = Double.parseDouble(scanner.nextLine());
  11.         double keyboardPrice = Double.parseDouble(scanner.nextLine());
  12.         double displayPrice = Double.parseDouble(scanner.nextLine());
  13.         //слушалки
  14.         int countHeadset = lostGames / 2;
  15.         double sumHeadset = countHeadset * headsetPrice;
  16.         //мишка
  17.         int countMouse = lostGames / 3;
  18.         double sumMouse = countMouse * mousePrice;
  19.         //клавиатура
  20.         int countKeyboard = lostGames / 6;
  21.         double sumKeyboard = countKeyboard * keyboardPrice;
  22.         //монитор
  23.         int countDisplays = lostGames / 12;
  24.         double sumDisplays = countDisplays * displayPrice;
  25.  
  26.         double expenses = sumHeadset + sumMouse + sumKeyboard + sumDisplays;
  27.  
  28.         System.out.printf("Rage expenses: %.2f lv.", expenses);
  29.  
  30.  
  31.  
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement