Advertisement
psi_mmobile

Untitled

Aug 27th, 2022
1,294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. public class MyClass {
  2.     public static void main(String args[]) {
  3.         java.util.Scanner scanner = new java.util.Scanner(System.in);
  4.         double money = scanner.nextDouble();
  5.         int students = scanner.nextInt();
  6.         double pricePerLightsabre = scanner.nextDouble();
  7.         double pricePerRobe = scanner.nextDouble();
  8.         double pricePerBelt = scanner.nextDouble();
  9.        
  10.         double total = 0.0;
  11.        
  12.         total = (Math.ceil(1.1 * students) * pricePerLightsabre) + (students * pricePerRobe) + (students - Math.floor(students/6)) * pricePerBelt;
  13.        
  14.         if(total <= money) {
  15.             System.out.printf("The money is enough - it would cost %.2flv.",total);
  16.         } else {
  17.             System.out.printf("George lucas would need %.2flv more.", total - money);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement