30 points + 5 points extra credit
You have been hired by the Rome News-Tribune to write simple player reviews for a Berry-Shorter soccer game, in which Berry beat Shorter by 7-0. Since you are too lazy to write out 11 individual reviews, you decide to have your computer do the job for you. A template for generating a player review is the following, and you should write a program that fills in the blanks appropriately to print out a complete review for a single player.
Player __________ played ____ hour(s), ____ minute(s) during this Friday's
Berry-Shorter soccer game. He had ____ assist(s) and scored ____ goal(s).
A proud Viking, he ____________________________.
To fill in this template, your program should ask the user to enter four inputs: name, number of minutes played, numbers of assists, and goals.
Based on the number of minutes input, you should print out the time in terms of total hours and minutes. To fill in the last blank, compute the player's rating by multiplying the number of goals by 3 and adding that to the number of assists. If the player's rating is less than 5, you should fill in the blank with "had a decent game". If it is between 5 and 9 (inclusive), fill in the blank with "he rocked the Shorter team". If the rating is 10 or above, say "made Shorter cry as we ran out of adjectives to describe his superb performance".
Note that you should print out the singular or plural forms of "hour", "minute", "assist", and "goal" appropriately, depending on the input.
Also, in your program, please break the lines at precisely the same place as in the template above -- that is, the first line ends with "Friday's", the second ends with "goal." or "goals.". If the player's rating is above 10, then end the third line with "adjectives" and print the remainder of the review on the fourth line.
The template above uses masculine pronouns; you may alter the template to use feminine pronouns if you would rather write reviews for the Lady Vikings team.
Make sure you test that your program works correctly for different input values of minutes, assists, goals, etc.
I have written a sample solution for this program which you can run to get an idea of how your program should work. From the machines in the computer lab, log in and go to the "M:\CLASSES\CS120\Section A\hw4" directory. Open the Review.java file using the SciTE text editor program, compile it and run it. Note that my version of this program does a little more than what you have to do for this assignment (see the Extra Credit section below).
Another way to run the sample program is to get to a DOS (command) prompt. Type "M:\" and then "cd \CLASSES\CS120\Section A\hw4". You should now be in the right directory. Now type "java Review" to run the program.
If you have trouble getting the sample solution to run please let me know. And I will give one point of extra credit if anyone finds something wrong with my program (i.e. it doesn't print singular/plural forms correctly for some input).
Take as an additional input to your program a string indicating whether the player is male or female and have your review automatically reflect that fact. (See the sample solution for an example of this.)
Assignment adapted from Zhong Shao, Yale University