Advertisement
Guest User

Untitled

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