Advertisement
psi_mmobile

Untitled

May 12th, 2022
1,109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 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.         String actorName = scanner.nextLine();
  5.         double academyPoints = scanner.nextDouble();
  6.         int reviewersCount = scanner.nextInt();
  7.         String reviewerName = null;
  8.         double reviewerRating = 0.0;
  9.         for (int i = 1; i <= reviewersCount; i++) {
  10.             reviewerName = scanner.next() + " " + scanner.next();
  11.             reviewerRating = scanner.nextDouble();
  12.             academyPoints = academyPoints + (reviewerName.length() * reviewerRating) / 2.0;
  13.             if (academyPoints > 1250.5) {
  14.                 System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!",actorName,academyPoints);
  15.                 break;
  16.             }
  17.         }
  18.         if (academyPoints < 1250.5) {
  19.             System.out.printf("Sorry, %s you need %.1f more!", actorName, 1250.5 - academyPoints);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement