Page 246 - DCAP305_PRINCIPLES_OF_SOFTWARE_ENGINEERING
P. 246
Principles of Software Engineering
Notes Customer
The customer class represents the customer of the store. Like the other classes it has data and
assessors:
class Customer{
private String _name;
private Vector _rentals = new Vector();
public Customer (String name)
{ name = _name;
public void addRental(Rental arg) {
_ rentals.addElement(arg);
public String getName ( )
{ return name:
};
Customer also has the method that produces a statement. Figure 12.2 shows the interactions for
this method. The body for this method is on the facing page.
Figure 12.2: Interactions for the Statement Method
public String statement()
{double total Amount = ();
int frequentRenterPoints = ();
Enumeration rentals = Jentals.elements ();
String result = “Rental Record for” + getName () + “\n”;
While (rentals.hasMoreElements ())
double thisAmount = 0;
Rental each = (Rental) rentalsmeNtElcment ();
//determine amounts for each line switch
240 LOVELY PROFESSIONAL UNIVERSITY