Replace temp with query. This is on p 20 and 21 ReplaceTempWithQueryP20
authorMichael Welch <michaelgwelch@gmail.com>
Mon, 6 Feb 2012 22:04:49 +0000 (16:04 -0600)
committerMichael Welch <michaelgwelch@gmail.com>
Mon, 6 Feb 2012 22:04:49 +0000 (16:04 -0600)
RefactoringChapter1/Customer.cs

index f397ccd..4320fb4 100644 (file)
@@ -31,7 +31,6 @@ namespace RefactoringChapter1
                        // determine ammounts for each line
                        foreach (Rental rental in rentals)
                        {
-                               double thisAmount = rental.Charge;
                                
                                // add frequent renter points
                                frequentRenterPoints++;
@@ -45,9 +44,9 @@ namespace RefactoringChapter1
                                
                                // show figures for this rental
                                result += "\t" + rental.Movie.Title + "\t" +
-                                       thisAmount + "\n";
+                                       rental.Charge + "\n";
                                
-                               totalAmount += thisAmount;
+                               totalAmount += rental.Charge;
                        }
                        
                        // add footer lines