meteor4o

10. Rage Expenses

May 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int lostgames = Integer.parseInt(sc.nextLine());
  8. double headsetPrice = Double.parseDouble(sc.nextLine());
  9. double mousePrice = Double.parseDouble(sc.nextLine());
  10. double kbPrice = Double.parseDouble(sc.nextLine());
  11. double displayPrice = Double.parseDouble(sc.nextLine());
  12.  
  13. int hsCrash = lostgames / 2;
  14. int msCrash = lostgames / 3;
  15. int kbCrash = lostgames / 6;
  16. int dispCrash = lostgames / 12;
  17.  
  18. double totalPrice = hsCrash * headsetPrice + msCrash * mousePrice + kbCrash * kbPrice + dispCrash * displayPrice;
  19.  
  20.  
  21. System.out.printf("Rage expenses: %.2f lv.", totalPrice);
  22.  
  23.  
  24. }
  25. }
Add Comment
Please, Sign In to add comment