Question: The invoice-printing program has an unfortunate flawit mixes application logic (the computation of total charges) and presentation (the visual appearance of the invoice). To appreciate
The invoice-printing program has an unfortunate flaw—it mixes “application logic” (the computation of total charges) and “presentation” (the visual appearance of the invoice). To appreciate this flaw, imagine the changes that would be necessary to draw the invoice in HTML for presentation on the Web. Reimplement the program, using a separate InvoiceFormatter class to format the invoice. That is, the Invoice and LineItem methods are no longer responsible for formatting. However, they will acquire other responsibilities, because the InvoiceFormatter class needs to query them for the values that it requires.
Step by Step Solution
3.33 Rating (165 Votes )
There are 3 Steps involved in it
ANSWER The Invoice class import InvoiceFormatter class Invoice def initself selflin... View full answer
Get step-by-step solutions from verified subject matter experts
