Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Problem05 {
- 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 pointsCalculated = 0;
- double pointsTotal = 0;
- for (int i = 0; i < judges; i++) {
- String judgeName = scanner.nextLine();
- double pointsJudge = Double.parseDouble(scanner.nextLine());
- pointsCalculated = (judgeName.length() * pointsJudge) / 2;
- pointsTotal = pointsCalculated + pointsAcademy;
- pointsAcademy = pointsTotal;
- if (pointsTotal > 1250.5) {
- break;
- }
- }
- if (pointsTotal > 1250.5) {
- System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!", actorName, pointsTotal);
- } else {
- System.out.printf("Sorry, %s you need %.1f more!", actorName, (1250.5 - pointsTotal));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement