SophiYo

Rage Expenses

Jan 25th, 2019
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. package O1Exercise;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Ex10RageExpenses {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         byte lostGames = Byte.parseByte(scanner.nextLine());
  9.         float headsetPrice = Float.parseFloat(scanner.nextLine());
  10.         float mousePrice = Float.parseFloat(scanner.nextLine());
  11.         float keyboardPrice = Float.parseFloat(scanner.nextLine());
  12.         float displayPrice = Float.parseFloat(scanner.nextLine());
  13.  
  14.         int headsets = lostGames / 2;
  15.         int mouses = lostGames / 3;
  16.         int keyboards = lostGames / 6;
  17.         int displays = lostGames / 12;
  18.  
  19.         float totalExpenses = headsets * headsetPrice + mouses * mousePrice + keyboards * keyboardPrice + displays * displayPrice;
  20.  
  21.         System.out.printf("Rage expenses: %.2f lv.", totalExpenses);
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment