Exactly 25 years ago, on February 24, 1980, the US Olympic Ice Hockey team has won its gold medal. This event was described in a recent movie "Miracle".
1. Write down a method named anniversary that, given the year of the event and current year, computes how many years have passed since that event. Show, on the example of 1980 and 2005, that your method correctly computes the value 25.
2. If a variable years has the initial value 25, and we run the following sequence of statements, what will be the resulting values of the variables next, many, and few:
int many = years * 10.0; int few = (int) years/10.0; next = years++; next--;What is the advantage of using next-- instead of next = next - 1?
3. After sending an email to your friends about the hockey anniversary, you realized that you accidentally got confused with the Miners miraculous 1966 victory and typed basketball instead of hockey. Write a code that, given a string email in which the term "basketball" appears exactly once, replaces this term with "hockey".
4. In hockey, winning is easy to describe:
5. In the competition between the three teams 1, 2, and 3, a team becomes a champion if it has earned more points than every other team. Write down a method champion1 that, given the overall number of points points1, points2, and points3 earned by each team, returns the value "true" or "false" depending on whether Team 1 is a champion.
6. What are the reasonable test cases for the method you developed for Problem 5? Explain your answer.
7. Let us assume that the points earned by the team in different games are stored, line by line, in a file points.dat. Write down a piece of code that, given this file, computes the overall number of points earned by the team.
8. To celebrate their victory, the hockey players usually skate in circles. To describe this celebration, define an object circle with the only field radius, constructor method, and methods that return the circle's diameter, circumference, and area. Use constant(s) and methods from the Math package.