Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. package BasicSyntaxConditionalsStatementsAndLoops;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class RageExpenses {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int lostGameCount = Integer.parseInt(scanner.nextLine());
  10. double headsetPrice = Double.parseDouble(scanner.nextLine());
  11. double mousePrice = Double.parseDouble(scanner.nextLine());
  12. double keyboardPrice = Double.parseDouble(scanner.nextLine());
  13. double displayPrice = Double.parseDouble(scanner.nextLine());
  14. double totalPrice = 0;
  15. int counter = 0;
  16. int counterLostgames = 0;
  17.  
  18. for (int i = 1; i <= lostGameCount; i++) {
  19. counterLostgames ++;
  20. if (i % 2 == 0) {
  21. totalPrice += headsetPrice;
  22. if (counterLostgames % 3 == 0) {
  23. totalPrice += mousePrice;
  24. totalPrice += keyboardPrice;
  25. counter ++;
  26. if (counter == 2) {
  27. totalPrice += displayPrice;
  28. counter = 0;
  29. }
  30. } continue;
  31. }
  32. if (i % 3 == 0) {
  33. totalPrice += mousePrice;
  34. }
  35. }System.out.printf("Rage expenses: %.2f lv.", totalPrice);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement