Advertisement
veronikaaa86

06. Oscars

Nov 21st, 2021
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. package forLoops;
  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 initAcademyPoints = Double.parseDouble(scanner.nextLine());
  11. int peopleAssess = Integer.parseInt(scanner.nextLine());
  12.  
  13. double totalPoints = initAcademyPoints;
  14. for (int i = 1; i <= peopleAssess; i++) {
  15.  
  16. String nameAssess = scanner.nextLine();
  17. double pointsAssess = Double.parseDouble(scanner.nextLine());
  18.  
  19. double currentAssesPoints = (nameAssess.length() * pointsAssess) / 2;
  20.  
  21. if (totalPoints < 1250.5) {
  22. totalPoints = totalPoints + currentAssesPoints;
  23. }
  24. }
  25.  
  26. if (totalPoints >= 1250.5) {
  27. System.out.printf("Congratulations, %s got a nominee for " +
  28. "leading role with %.1f!", actorName, totalPoints);
  29. } else {
  30. double diff = 1250.5 - totalPoints;
  31. System.out.printf("Sorry, %s you need %.1f more!",
  32. actorName, diff);
  33. }
  34. }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement