Advertisement
veronikaaa86

05. Oscars

Aug 13th, 2022
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P05Oscars {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String nameActor = scanner.nextLine();
  10.         double pointsAcademy = Double.parseDouble(scanner.nextLine());
  11.         int countJudges = Integer.parseInt(scanner.nextLine());
  12.  
  13.         double totalPoints = pointsAcademy;
  14.         for (int i = 1; i <= countJudges; i++) {
  15.             String nameJudge = scanner.nextLine();
  16.             double judgePoints = Double.parseDouble(scanner.nextLine());
  17.  
  18.             double currentPoints = (nameJudge.length() * judgePoints) / 2;
  19.  
  20.             totalPoints = totalPoints + currentPoints;
  21.  
  22.             if (totalPoints >= 1250.5) {
  23.                 break;
  24.             }
  25.         }
  26.  
  27.         if (totalPoints < 1250.5) {
  28.             double diff = 1250.5 - totalPoints;
  29.             System.out.printf("Sorry, %s you need %.1f more!", nameActor, diff);
  30.         } else {
  31.             System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!", nameActor, totalPoints);
  32.         }
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement