Advertisement
CoineTre

JF-ExcBasic10.Rage Expenses

Jan 16th, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Test {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int lostGameCount = Integer.parseInt(scanner.nextLine());
  7.         double headsetPrice = Double.parseDouble(scanner.nextLine());
  8.         double mousePrice = Double.parseDouble(scanner.nextLine());
  9.         double keyboardPrice = Double.parseDouble(scanner.nextLine());
  10.         double displayPrice = Double.parseDouble(scanner.nextLine());
  11.         int secondLost = lostGameCount /2;
  12.         int thirdLost = lostGameCount / 3;
  13.         int keybordTimesTrashed= lostGameCount/6;
  14.         int displayTimesTrashed = lostGameCount/12;
  15.         double trashedHeadset = secondLost * headsetPrice;
  16.         double trashedMouse= thirdLost * mousePrice;
  17.         double trashedKeybord=keybordTimesTrashed * keyboardPrice;
  18.         double trashedDisplay = displayTimesTrashed * displayPrice;
  19.         double totalSum= trashedHeadset+trashedMouse + trashedKeybord + trashedDisplay;
  20.         System.out.printf("Rage expenses: %.2f lv.",totalSum);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement