Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package O1Exercise;
- import java.util.Scanner;
- public class Ex10RageExpenses {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- byte lostGames = Byte.parseByte(scanner.nextLine());
- float headsetPrice = Float.parseFloat(scanner.nextLine());
- float mousePrice = Float.parseFloat(scanner.nextLine());
- float keyboardPrice = Float.parseFloat(scanner.nextLine());
- float displayPrice = Float.parseFloat(scanner.nextLine());
- int headsets = lostGames / 2;
- int mouses = lostGames / 3;
- int keyboards = lostGames / 6;
- int displays = lostGames / 12;
- float totalExpenses = headsets * headsetPrice + mouses * mousePrice + keyboards * keyboardPrice + displays * displayPrice;
- System.out.printf("Rage expenses: %.2f lv.", totalExpenses);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment