Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String args[]) {
- java.util.Scanner scanner = new java.util.Scanner(System.in);
- double money = scanner.nextDouble();
- int students = scanner.nextInt();
- double pricePerLightsabre = scanner.nextDouble();
- double pricePerRobe = scanner.nextDouble();
- double pricePerBelt = scanner.nextDouble();
- double total = 0.0;
- total = (Math.ceil(1.1 * students) * pricePerLightsabre) + (students * pricePerRobe) + (students - Math.floor(students/6)) * pricePerBelt;
- if(total <= money) {
- System.out.printf("The money is enough - it would cost %.2flv.",total);
- } else {
- System.out.printf("George lucas would need %.2flv more.", total - money);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement