SECTION C You can gain enough marks for a C grade by successfully completing this section. 1. Write a class, IPC, as a subclass1 of Team. 2. IPC teams are entrants to the International Programming Contest. To enter this contest a team may represent a university or a polytechnic. Add a field to store this information. 3. Write the constructor so that IPC teams from universities and polytechnics can both be created. Test C_1 should now compile. If it does not, compare your constructor's signature with that used in the test. Change your code, not the test. 4. Write an accessor method isUniTeam to show if a team represents a university. It must return true if it does, false if it represents a polytechnic. Test C_2 should now compile. If it does not, compare your constructor's signature with that used in the test. 5. Override toString in your IPC class so that it displays whether the team is from a university or a polytechnic. Test C_3 should now give you suitable output. Notes  It is your responsibility to ensure that the code files for your solution (particularly your .java files) are located on drive H:. Check that this is so before you logout. Failure to do so may result in the loss of your work.  Make sure your solution follows the programming standards used in Programming 2. Where is your Section C solution saved (folder name)? ..................................................................................................................................... 1 Subclass = child or descendant class. 5 Semester 2, 2007 SECTION B You can gain enough marks for a B grade by successfully completing this section as well as section C. 6. Add an abstract method calculateScore to the Team class. Its signature should be: public int calculateScore(int iProblemsSolved); where iProblemsSolved is the number of problems solved in the contest. 7. Implement calculateScore in the IPC class. The score is calculated as follows:  For the first 3 problems solved, score 1 point each.  For the 4th to 6th problems solved, score 3 points each.  For the 7th solved problem onwards score 5 points each. Test B should now work. However, some of the C tests (the ones that create Teams) will no longer compile. This is not a problem. The expected scores in the test unit are correct - do not alter them to make your code work! Notes  It is your responsibility to ensure that the code files for your solution (particularly your .java files) are located on drive H:. Check that this is so before you logout. Failure to do so may result in the loss of your work.  Make sure your solution follows the programming standards used in Programming 2. Where is your Section B solution saved (folder name)? .............................................. ..................................................................................................................................... [TURN OVER] Programming 2 Test 1 6 SECTION A For an A grade you will need to successfully complete this section as well as sections B and C. Write a new subclass of Team to represent another type of team of your choice. Give it one new field (nothing to do with universities), write an accessor method for that field, and write the constructor so that the field may be suitably initialised. Briefly describe below the nature of your new field: ..................................................................................................................................... ..................................................................................................................................... ..................................................................................................................................... 8. Implement calculateScore and toString for your new class. calculateScore must have its own rules. You will not get any marks if they are the same as the rules for an IPC Team! Describe below what they are: ..................................................................................................................................... ..................................................................................................................................... ..................................................................................................................................... 9. Write a test unit, TestA, to show that your new class is fully functional. Notes  It is your responsibility to ensure that the code files for your solution (particularly your .java files) are located on drive H:. Check that this is so before you logout. Failure to do so may result in the loss of your work.  Make sure your solution follows the programming standards used in Programming 2. Where is your Section A solution saved (folder name)? .............................................. .....................................................................................................................................