Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package examPreparation;
- import java.util.Scanner;
- public class P04Oscars {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String actorName = scanner.nextLine();
- double pointsAcademy = Double.parseDouble(scanner.nextLine());
- int judges = Integer.parseInt(scanner.nextLine());
- double totalPoints = pointsAcademy;
- for (int i = 0; i < judges; i++) {
- String judgeName = scanner.nextLine();
- double pointsJudge = Double.parseDouble(scanner.nextLine());
- int lengthName = judgeName.length();
- double calculatedPoints = (lengthName * pointsJudge) / 2;
- totalPoints = totalPoints + calculatedPoints;
- if (totalPoints > 1250.5) {
- break;
- }
- }
- if (totalPoints > 1250.5) {
- System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!",
- actorName, totalPoints);
- } else {
- System.out.printf("Sorry, %s you need %.1f more!",
- actorName, 1250.5 - totalPoints);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement