Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package src;
- import java.util.Scanner;
- public class RageExpenses {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int countLostGames = Integer.parseInt(scanner.nextLine());
- double headsetPrice = Double.parseDouble(scanner.nextLine());
- double mousePrice = Double.parseDouble(scanner.nextLine());
- double keyboardPrice = Double.parseDouble(scanner.nextLine());
- double displayPrice = Double.parseDouble(scanner.nextLine());
- int countHeadset = countLostGames / 2;
- int countMice = countLostGames / 3;
- int countKeyboards = countLostGames / 6;
- int countMonitors = countLostGames / 12;
- double expenses = (countHeadset * headsetPrice)
- + (countMice * mousePrice)
- + (countKeyboards * keyboardPrice)
- + (countMonitors * displayPrice);
- System.out.printf("Rage expenses: %.2f lv.", expenses);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment