Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package src;
- import java.util.Scanner;
- public class PadawanEquipment {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double money = Double.parseDouble(scanner.nextLine());
- int studentsCount = Integer.parseInt(scanner.nextLine());
- double lightSabersPrice = Double.parseDouble(scanner.nextLine());
- double robesPrice = Double.parseDouble(scanner.nextLine());
- double beltsPrice = Double.parseDouble(scanner.nextLine());
- double sumLightSabers = lightSabersPrice * Math.ceil(studentsCount + 0.10 * studentsCount); //studentsCount * 1.1;
- double sumRobes = studentsCount * robesPrice;
- double sumBelts = (studentsCount - studentsCount / 6) * beltsPrice;
- double totalSum = sumLightSabers + sumRobes + sumBelts;
- if (totalSum <= money) {
- System.out.printf("The money is enough - it would cost %.2flv.",
- totalSum);
- } else {
- double needMoney = totalSum - money;
- System.out.printf("George Lucas will need %.2flv more.", needMoney);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment