Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
93
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. public class demo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int games = Integer.parseInt(scanner.nextLine());
  8. double headsetPrice = Double.parseDouble(scanner.nextLine());
  9. double mousePrice = Double.parseDouble(scanner.nextLine());
  10. double keyboardPrice = Double.parseDouble(scanner.nextLine());
  11. double displayPrice = Double.parseDouble(scanner.nextLine());
  12.  
  13. int headsets = games/2;
  14. int mice = games/3;
  15. int keyboard = games/6;
  16. int display = games/12;
  17.  
  18. double total = headsets*headsetPrice+mice*mousePrice+keyboard*keyboardPrice+display*displayPrice;
  19.  
  20. System.out.printf("Rage expenses: %.2f lv.",total);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement