Skip to content
A Programmer edited this page Feb 13, 2024 · 3 revisions

Customer Class

A subclass of the User class. It introduces new fields: address, phoneNumber, sex, age, and a list of Vehicle objects (vehicles). Constructors allow the instantiation of a Customer object with or without specific attribute values. Author: Kyle Williamson

New Features

address: A string representing the customer's address.

phoneNumber: A string representing the customer's phone number.

sex: A string representing the customer's gender.

age: An integer representing the customer's age.

vehicles: A list of Vehicle objects representing vehicles associated with the customer.

Constructors:

public Customer(): Default constructor for general technical operations, initializing attributes with default values and an empty list of vehicles.

public Customer(int userID, String passwordKey, String firstName, String lastName, String email, String address, String phoneNumber, String sex, int age): Constructor for creating a new customer with specified attribute values and an empty list of vehicles. Getter and Setter Methods:

Getter Method:

getAddress(): Gets the Address

getPhoneNumber(): Gets the Phone Number

getAge(): Gets the Age

getSex(): Gets the gender

Setter Methods:

setAddress(): Sets the Address

setSex(): Sets the Gender

setAge(): Sets the Age

setPhoneNumber(): Sets the Phone Number

Other Methods (relates to the Vehicle Class)

addVehicle(Vehicle vehicle): Method to add a vehicle to the list of vehicles.

removeVehicle(Vehicle vehicle): Method to remove a vehicle from the list of vehicles.

getVehicles(): Method to retrieve the list of vehicles associated with the customer.

Override toString Method: Overrides the toString method to include user-specific information from the superclass (User) and additional customer-specific information such as address, phone number, sex, age, and a formatted list of vehicles.

Clone this wiki locally