Name: ___________________________________________________
Umail Address: ______________________________@ umail.ucsb.edu
Circle one: 10am 11am
Please write your name only on this page.
That allows me to grade your exams without knowing whose exam I am grading.
This exam is closed book, closed notes, closed mouth, cell phone off,
except for:
There are 100 points worth of questions on the exam, and you have 75 minutes to complete the exam.
A hint for allocating your time—on your first pass through the exam:
If you do that, after you complete your first pass through the exam in 50 minutes, you'll still have 25 minutes to:
There is more room on the next page for your answer if you run out of room here.
Extra space for your answer to question 1
ArrayList<E> |
||
Constructor: | ArrayList<E>(int initialCapacity) |
Constructs an empty list with the specified initial capacity. |
Methods: | int size() |
Returns the number of elements in this list. |
E get(int index) |
Returns the element at the specified position in this list. | |
boolean add(E e) |
Appends the specified element to the end of this list, and returns true |
public class TeamRoster extends ArrayList<TeamMember> {
The TeamMember class is the same one you wrote for question 1 of this exam, and the same one described on the additional handout you got with this exam.
The TeamRoster class has no data members defined (other than the ones inherited from ArrayList<TeamMember>, which are all private.
Inside the TeamMember class, you need to write two public methods.
null
. An example call:TeamRoster bballTeam = new TeamRoster(); ... // code here adds TeamMember objects to bballTeam String name=bballTeam.jerseyToName(22);
TeamRoster soccerTeam = new TeamRoster(); ... // code here adds TeamMember objects to soccerTeam TeamRoster defenders=soccerTeam.subroster(new int [] {2,4,12,13,16,31});
for (int i=0; i<something; i++) {...}
for (Dog d: dogs) {...}
More space on the next page if you need it
Extra space for your answer to previous question in case you need it.
Total points: ?