OOP-04

class Customer... public String statement { double totalAmount = 0; int frequentRenterPoints = 0; Enumeration rentals = _rentals.elements; String result = "Rental Record for " + getName + "\n"; while (rentals.hasMoreElements) { Rental each = (Rental) rentals.nextElement; ** frequentRenterPoints += each.getFrequentRenterPoints; **

//show figures for this rental// //result += "\t" + each.getMovie.getTitle+ "\t" + // //String.valueOf(each.getCharge) + "\n"; // //totalAmount += each.getCharge; // //} //

result += "Amount owed is " + String.valueOf(totalAmount) + "\n"; result += "You earned " + String.valueOf(frequentRenterPoints) + " frequent renter points"; <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0cm; margin-top: 0cm; text-indent: 36pt;">return result; <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; text-indent: 36pt;">}

class Rental... <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; text-indent: 36pt;">int getFrequentRenterPoints { <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0cm; margin-top: 0cm; text-indent: 36pt;">if ((getMovie.getPriceCode == Movie.NEW_RELEASE) && <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; margin-left: 72pt; margin-right: 0cm; margin-top: 0cm; text-indent: 36pt;">getDaysRented > 1) <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; margin-left: 108pt; margin-right: 0cm; margin-top: 0cm;">return 2; <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; margin-left: 36pt; margin-right: 0cm; margin-top: 0cm; text-indent: 36pt;">else <span style="font-family: 'Courier New'; font-size: 13px; line-height: normal; margin-bottom: 0pt; margin-left: 72pt; margin-right: 0cm; margin-top: 0cm; text-indent: 36pt;">return 1; <span style="font-family: 'Courier New'; font-size: 13px; line-height: 115%; margin-left: 36pt; text-indent: 36pt;">}