Advertisement
veronikaaa86

06. Oscars

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