lecture7_2up

lecture7_2up - O b j e c t O r i e n t e d S o f t w a r e...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 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. 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” +result += “\t” + each....
View Full Document

Page1 / 41

lecture7_2up - O b j e c t O r i e n t e d S o f t w a r e...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online