la-ma-rin

padawanEqupment2

Jan 26th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class padawanEquipment {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         int budget = Integer.parseInt(scan.nextLine());
  8.         double number = Double.parseDouble(scan.nextLine());
  9.         double sabrePrice = Double.parseDouble(scan.nextLine());
  10.         double robesPrice = Double.parseDouble(scan.nextLine());
  11.         double beltsPrice = Double.parseDouble(scan.nextLine());
  12.  
  13.         double total = sabrePrice * (number + Math.ceil(number * 0.1)) + robesPrice * number +
  14.                 beltsPrice * (number - number / 6);
  15.  
  16.         if (budget >= total) {
  17.             System.out.printf("The money is enough - it would cost %.2flv.", total);
  18.         } else if (total > budget) {
  19.             System.out.printf("Ivan Cho will need %.2flv more.", total - budget);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment