Skip to content

Instantly share code, notes, and snippets.

@rightson
Created July 6, 2016 03:16
Show Gist options
  • Save rightson/4c6ed636f1365b145fd0fcebc90716cc to your computer and use it in GitHub Desktop.
Save rightson/4c6ed636f1365b145fd0fcebc90716cc to your computer and use it in GitHub Desktop.
public String htmlStatement() {
Enumeration rentals = _rentals.elements();
String result = "<H1>Rentals for <EM>" + getName() + "</EM></H1><P>\n";
while (rentals.hasMoreElements()) {
Rental each = (Rental) rentals.nextElement();
//show figures for each rental
result += each.getMovie().getTitle()+ ": " +
String.valueOf(each.getCharge()) + "<BR>\n";
}
//add footer lines
result += "<P>You owe <EM>" + String.valueOf(getTotalCharge()) +
"</EM><P>\n";
result += "On this rental you earned <EM>" +
String.valueOf(getTotalFrequentRenterPoints()) +
"</EM> frequent renter points<P>";
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment