daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest Mar 21st, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class IntroPagawanEquipment {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double money = Double.parseDouble(scanner.nextLine());
  8.  
  9.         int countStudents = Integer.parseInt(scanner.nextLine());
  10.  
  11.         double lightSabresPrice = Double.parseDouble(scanner.nextLine());
  12.         double robesPrice = Double.parseDouble(scanner.nextLine());
  13.         double beltsPrice = Double.parseDouble(scanner.nextLine());
  14.  
  15.         double allRopes = robesPrice * countStudents;
  16.         double allBelts =0;
  17.  
  18.         double allLightSabre = lightSabresPrice * (countStudents + Math.ceil(countStudents * 0.1));
  19.  
  20.  
  21.         if (countStudents >=6){
  22.             allBelts = beltsPrice * ((countStudents - countStudents/6d));
  23.         }else {
  24.            allBelts = beltsPrice * countStudents;
  25.         }
  26.  
  27.         double price = allLightSabre + allRopes + allBelts;
  28.  
  29.         if (money >= price){
  30.             System.out.printf("The money is enough - it would cost %.2flv.",price);
  31.         }else {
  32.             System.out.printf("Ivan Cho will need %.2flv more.", Math.abs(price - money));
  33.         }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top