Advertisement
MladenKarachanov

Untitled

Mar 21st, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. package firstStepsInCoding;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class FinalCompetition {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. int numberOfDancers = Integer.parseInt(scanner.nextLine());
  9. double numberOfPoints = Double.parseDouble(scanner.nextLine());
  10. String season = scanner.nextLine();
  11. String place = scanner.nextLine();
  12. double reward = 0;
  13. double costs=0;
  14. double result=0;
  15. double charity=0;
  16. if (season.equals("summer")) {
  17. if (place.equals("Bulgaria")) {
  18. reward = numberOfDancers * numberOfPoints;
  19. costs=reward*5/100;
  20. result=reward-costs;
  21. charity=result*75/100;
  22.  
  23. } else if (place.equals("Abroad")) {
  24. reward = numberOfDancers * numberOfPoints + (numberOfDancers * numberOfPoints / 2);
  25. costs=reward*10/100;
  26. result=reward-costs;
  27. charity=result*75/100;
  28.  
  29. }
  30. }
  31. if (season.equals("winter")) {
  32.  
  33. if (place.equals("Bulgaria")) {
  34. reward = numberOfDancers * numberOfPoints;
  35. costs = reward * 8 / 100;
  36. result = reward - costs;
  37. charity = result * 75 / 100;
  38.  
  39.  
  40. } else if (place.equals("Abroad")) {
  41. reward = numberOfDancers * numberOfPoints + (numberOfDancers * numberOfPoints / 2);
  42. costs = reward * 15 / 100;
  43. result = reward - costs;
  44. charity = result * 75 / 100;
  45.  
  46. }
  47. }
  48. double diff=Math.abs(result-charity);
  49. System.out.printf("Charity - %.2f%n",charity);
  50. System.out.printf("Money per dancer - %.2f",diff/numberOfDancers);
  51. }
  52. }
  53.  
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement