Advertisement
Valantina

Oscars

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