{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture7_2up - Object Oriented Software Engineering...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
January 02, 2009 O b j e c t O r i e n t e d S o f t w a r e E n g i n e e r i n g 366 Refactoring Lecture 7
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
January 02, 2009 O b j e c t O r i e n t e d S o f t w a r e E n g i n e e r i n g 377 Refactoring: problem statement Add a htmlStatment method which returns a customer statement string containing html tags. ...and there will be some changes to the way movies are classified ...affecting frequent renter points and charging.
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
January 02, 2009 O b j e c t O r i e n t e d S o f t w a r e E n g i n e e r i n g 380 Refactoring: step 2 public String statement() { double totalAmount = 0; int frequentRenterPoints = 0; Enumeration rentals = _rental.elements(); String result = “Rental Record for “ + getName() + “\n”; while (rentals.hasMoreElements()) { double thisAmount = 0; Rental each = (Rental) rentals.nextElement(); thisAmount = amountFor(each); frequentRenterPoints ++; if ((each.getMovie().getPriceCode() == Movie.NEW_RELEASE)&& each.getDaysRented() > 1) frequentRenterPoints++; result += “\t” + each.getMovie().getTitle()+ “\t” + String.valueOf(thisAmount) + “\n”;
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}