Final answer:
The question involves creating a Person class with fields for a person's details and a Customer class that inherits from Person, adding extra fields and methods.
Step-by-step explanation:
To answer your question, you would start by designing a Person class with private fields for the name, address, and telephone number, all of which are strings. A constructor would be used to initialize these fields, and you would provide accessor (getter) and mutator (setter) methods for each. Here is an example in Java:
public class Person {
private String name;
private String address;
private String phoneNumber;
public Person(String name, String address, String phoneNumber) {
this.name = name;
this.address = address;
this.phoneNumber = phoneNumber;
}
// Accessor and Mutator Methods
public String getName() { return name; }
public void setName(String name) { this.name = name; }
// ... Additional getters and setters for other fields
}
The Customer class would extend the Person class and include additional fields: a customer number and a boolean for the mailing list preference. Similarly, it would have a constructor, accessors, and mutators:
public class Customer extends Person {
private String customerNumber;
private boolean wantsMailingList;
public Customer(String name, String address, String phoneNumber,
String customerNumber, boolean wantsMailingList) {
super(name, address, phoneNumber);
this.customerNumber = customerNumber;
this.wantsMailingList = wantsMailingList;
}
// Accessor and Mutator Methods for new fields
// ...
}