Question: Solve the Following problem and write it's code in Java Programming Language. Consider a personal checkbook management program like Quicken. It manages several bank accounts
Solve the Following problem and write it's code in Java Programming Language.
Consider a personal checkbook management program like Quicken. It manages several bank accounts and investments and can handle your bill paying. Where could you use a Factory pattern in designing a program like that? We can start thinking that what could be our parent class. In above scenario we can consider CheckBook as parent class and let assume we have three type of check for this checkbook Travel, Health and Personal. These will be our child classes which have method to decide corresponding expenses or could be done with the help of Dependency Injection. We also need to create a CheckFactory class to implement Simple Factory Design Pattern. The UML diagram for this is shown in figure below. CheckBook CheckFactory +getExpense( ) decimal + chooseExpense( CheckBook Travel Health Personal getExpense( ) decimal getExpensel )decimal getExpense( )decimal
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
CheckFactoryjava import javautilScanner public class CheckFactory Scanner inputSomethingnew ScannerS... View full answer
Get step-by-step solutions from verified subject matter experts
