Page 598 - AP Computer Science A, 7th edition
P. 598

array was incorrectly typed as 12 instead of 2. What would be the result of running the program?
(A) A rating of 12 would be listed with a frequency of 1 in the output table.
(B) A rating of 1 would be listed with a frequency of 12 in the output table.
(C) An ArrayIndexOutOfBoundsException would be thrown.
(D) A StringIndexOutOfBoundsException would be thrown.
(E) A NullPointerException would be thrown.
Questions 23–25 are based on the three classes below:
public class Employee {
private String name;
private int employeeNum;
private double salary, taxWithheld;
public Employee(String aName, int empNum, double aSalary, double aTax)
{ /∗ implementation not shown ∗/ }
/∗ ∗ @return pre-tax salary public double getSalary() { return salary; }
public String getName() { return name; }
public int getEmployeeNum() { return employeeNum; }
public double getTax() { return taxWithheld; }
public double computePay()
∗ /
{ return salary – taxWithheld; } }















































































   596   597   598   599   600