Refer to the following classes for Question.
public class Address
{
private String name;
private String street;
private String city;
private String state;
private String zip;
//constructors
...
//accessors
public String getName()
{ return name; }
public String getStreet()
{ return street; }
public String getCity()
{ return city; }
public String getState()
{ return state; }
public String getZip()
{ return zip; }
}
public class Student
{
private int idNum;
private double gpa;
private Address address;
//constructors
...
//accessors
public Address getAddress()
{ return address; }
public int getIdNum()
{ return idNum; }
public double getGpa()
{ return gpa; }
}
The following code segment is to print out a list of addresses:
for (Address addr : list)
{
/* more code */
}
Which is a correct replacement for
/* more code */?
I
Console.WriteLine(list[i].getName());
Console.WriteLine(list[i].getStreet());
Console.WriteLine(list[i].getCity() + ", ");
Console.WriteLine(list[i].getState() + " ");
Console.WriteLine(list[i].getZip());
II
Console.WriteLine(addr.getName());
Console.WriteLine(addr.getStreet());
Console.WriteLine(addr.getCity() + ", ");
Console.WriteLine(addr.getState() + " ");
Console.WriteLine(addr.getZip());
III
Console.WriteLine(addr);
(A) I only
(B) II only
(C) III only
(D) I and II only
(E) I, II, and III