Advertisement
GabrielHr00

06. Oscars

Jun 4th, 2023
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. package S4_FoorLoops;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Oscars {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         String actorName = scanner.nextLine();
  9.         double startingPoints = Double.parseDouble(scanner.nextLine());
  10.         int gradersCount = Integer.parseInt(scanner.nextLine());
  11.  
  12.         for (int i = 1; i <= gradersCount; i++) {
  13.             String graderName = scanner.nextLine();
  14.             double points = Double.parseDouble(scanner.nextLine());
  15.  
  16.             startingPoints += graderName.length() * points / 2;
  17.  
  18.             if(startingPoints > 1250.5) {
  19.                 System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!", actorName, startingPoints);
  20.                 break;
  21.             }
  22.         }
  23.  
  24.         if(startingPoints <= 1250.5) {
  25.             System.out.printf("Sorry, %s you need %.1f more!", actorName, 1250.5 - startingPoints);
  26.         }
  27.  
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement