Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package S4_ForLoops;
- import java.util.Scanner;
- public class Oscars {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String actorName = scanner.nextLine();
- double startingPoints = Double.parseDouble(scanner.nextLine());
- int juryCount = Integer.parseInt(scanner.nextLine());
- for (int i = 1; i <= juryCount; i++) {
- // read info about jury
- String graderName = scanner.nextLine();
- double pointFromGrader = Double.parseDouble(scanner.nextLine());
- // calc grade for actor
- double gradeForActor = graderName.length() * pointFromGrader / 2;
- // add points to starting points
- // startingPoints = startingPoints + gradeForActor;
- startingPoints += gradeForActor;
- if(startingPoints > 1250.5) {
- System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!", actorName, startingPoints);
- break;
- }
- }
- // check if not enough money
- if(startingPoints <= 1250.5) {
- double diff = 1250.5 - startingPoints;
- System.out.printf("Sorry, %s you need %.1f more!", actorName, diff);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement