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