Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String args[]) {
- java.util.Scanner scanner = new java.util.Scanner(System.in);
- int lostGames = scanner.nextInt();
- double headsetPrice = scanner.nextDouble();
- double mousePrice = scanner.nextDouble();
- double keyboardPrice = scanner.nextDouble();
- double displayPrice = scanner.nextDouble();
- int kbSmashCount = 0;
- double damageCost = 0.0;
- for(int game = 1; game <= lostGames; game++) {
- if(game % 2 == 0) {
- damageCost+=headsetPrice;
- }
- if (game % 3 == 0) {
- damageCost+=mousePrice;
- }
- if (game % 6 == 0) {
- kbSmashCount++;
- damageCost+=keyboardPrice;
- if (kbSmashCount % 2 == 0) {
- damageCost+=displayPrice;
- }
- }
- }
- System.out.printf("Rage expenses: %.2f lv.", damageCost);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement