Reputation: 163
I need some assistance in quite a sticky situation. My program is working fine as it is but I was told to change how a class is working. What I have is a Booking Class which extends a Customer Class to get the Customer details. Now I was told that the Booking Class must have a property of type Customer instead of extending the Class. Then in my program I load the Customer as a whole object instead of reading line by line and inserting them into the text boxes. Anyone can help me through this?
public class Booking implements Serializable{
private String flighttime;
private String flightlocation;
private String flightfee;
private boolean car;
private boolean insurance;
private Customer customer;
/**
* @return the flighttime
*/
public String getFlighttime() {
return flighttime;
}
/**
* @param flighttime the flighttime to set
*/
public void setFlighttime(String flighttime) {
this.flighttime = flighttime;
}
/**
* @return the flightlocation
*/
public String getFlightlocation() {
return flightlocation;
}
/**
* @param flightlocation the flightlocation to set
*/
public void setFlightlocation(String flightlocation) {
this.flightlocation = flightlocation;
}
/**
* @return the flightfee
*/
public String getFlightfee() {
return flightfee;
}
/**
* @param flightfee the flightfee to set
*/
public void setFlightfee(String flightfee) {
this.flightfee = flightfee;
}
/**
* @return the car
*/
public boolean getCar() {
return isCar();
}
/**
* @param car the car to set
*/
public void setCar(boolean car) {
this.car = car;
}
/**
* @return the car
*/
public boolean isCar() {
return car;
}
/**
* @return the insurance
*/
public boolean isInsurance() {
return insurance;
}
/**
* @param insurance the insurance to set
*/
public void setInsurance(boolean insurance) {
this.insurance = insurance;
}
public boolean getInsurance() {
return isInsurance();
}
/**
* @return the customer
*/
public Customer getCustomer() {
return customer;
}
/**
* @param customer the customer to set
*/
public void setCustomer(Customer customer) {
this.customer = customer;
}
}
Upvotes: 1
Views: 199
Reputation: 285405
Then in my program I load the Customer as a whole object instead of reading line by line and inserting them into the text boxes.
public Booking(Customer customer, ...<other params>)
or via a setter method, public void setCustomer(Customer customer) {...}
, or both.Upvotes: 2