deyanivanov966

EXAM 31.10 // 03. Final Competition

Oct 31st, 2020 (edited)
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.       int dancers = Integer.parseInt(scanner.nextLine());
  8.       double points = Double.parseDouble(scanner.nextLine());
  9.       String season = scanner.nextLine();
  10.       String location = scanner.nextLine();
  11.  
  12.       double money = 0;
  13.  
  14.  
  15.       if(location.equals("Bulgaria")){
  16.           money = dancers * points;
  17.       }else{
  18.           money = dancers * points * 1.5;
  19.       }
  20.  
  21.       if(season.equals("summer")){
  22.           if(location.equals("Bulgaria")){
  23.              money = money - money * 0.05;
  24.           }else{
  25.               money = money - money * 0.1;
  26.           }
  27.       }else{
  28.           if(location.equals("Bulgaria")){
  29.               money = money - money * 0.08;
  30.           }else{
  31.               money = money - money * 0.15;
  32.           }
  33.       }
  34.  
  35.       double moneyForDonation = money * 0.75;
  36.       double moneyLeft = money - moneyForDonation;
  37.  
  38.       double moneyPerDancer = moneyLeft / dancers;
  39.  
  40.         System.out.printf("Charity - %.2f\nMoney per dancer - %.2f\n", moneyForDonation, moneyPerDancer);
  41.  
  42.     }
  43. }
Add Comment
Please, Sign In to add comment