Advertisement
SensaBG

Oscars

Jul 1st, 2024
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class OscarsPBexam4 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String actor = scanner.nextLine();
  8.         double initialPoints = Double.parseDouble(scanner.nextLine());
  9.  
  10.         int juryAmount = Integer.parseInt(scanner.nextLine());
  11.  
  12.         while (juryAmount-- > 0) {
  13.             String jury = scanner.nextLine();
  14.             double givenPoints = Double.parseDouble(scanner.nextLine());
  15.             double bonusPoints = jury.length();
  16.  
  17.             initialPoints += bonusPoints * givenPoints / 2;
  18.  
  19.             if (initialPoints > 1250.5) {
  20.                 System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!", actor, initialPoints);
  21.                 return;
  22.             }
  23.         }
  24.         System.out.printf("Sorry, %s you need %.1f more!", actor, Math.abs(1250.5 - initialPoints));
  25.    
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement