Answer Key
1.
a. sqrFeet, cost
b. name
c. sqrFeet
d. name, cost
2.
a. 15
b. An array of Boxes
c. A Box
3. B
4. C
5. D
6. C
7. B
8. B
9. B
10. A
11. C
12. A
13. B
14. A
15. D
16. 10 9 8 7 6
17. B
18. 10 7 4 1
19. D
20. C
21. A
22. E
23.
Student[] studentArray = new Student[10]; //declared studentArray
for (int i = 0; i < studentArray.length; i++){
studentArray[i] = new Student(); //initialize each Student in the array
}
public static int aboveSixty(Student[] list){ //take in an array of Students as the argument
int count = 0;
for (int j = 0; j < list.length; j++){
if (list[j].getGrade() > 60)
count++;
}
return count;
}
Here's how you could call this method from the main method:
public static void main (String[] args){
Student[] studentArray = new Student[10]; //declared studentArray
for (int i = 0; i < studentArray.length; i++){
studentArray[i] = new Student(); //initialize each Student in the array
}
System.out.println(aboveSixty(studentArray)); //assuming the aboveSixty method is in
//the same class as the main method
}
Powered by TCPDF (www.tcpdf.org)