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