Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class padawanEquipment {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int budget = Integer.parseInt(scan.nextLine());
- double number = Integer.parseInt(scan.nextLine());
- double sabrePrice = Double.parseDouble(scan.nextLine());
- double robesPrice = Double.parseDouble(scan.nextLine());
- double beltsPrice = Double.parseDouble(scan.nextLine());
- double total = sabrePrice * (number + Math.ceil(number * 0.1)) + robesPrice * number +
- beltsPrice * (number - number / 6);
- if (budget >= total) {
- System.out.printf("The money is enough - it would cost %.2flv.", total);
- } else if (total > budget) {
- System.out.printf("Ivan Cho will need %.2flv more.", total - budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment