Advertisement
Didart

Oscars

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