Create a new project in Eclipse called Assignment 2.
Create a package within this project called bank. To this package add the classes Account, Bank, CreditAccount, SavingsAccount and Customer.
Create a second package called person. To this package add the classes Person and Address.
Make sure you use the classes supplied and do not use your own. Several changes have been made to these classes. For example, the Date class is no longer used (thus Customer has no date of birth). Each new Customer has exactly one SavingsAccount and one CreditAccount (created when the Customer object is created). Make sure you examine each of these classes closely.
Task 1
Task 1 involves setting up the controls for the main JFrame window. Other windows (dialog boxes) will be invoked from this window. They will be described in later tasks. For this task it suffices to set up the components and listeners for the main window.
Create a package called task01.
Create a class called TestBankApplication. This class should extend JFrame and implement ActionListener. It should contain the main method that runs the application. The window created should be the starting point for all of the functionality for your application.
Firstly, provide an instance variable which provides an object of class Bank (from the bank package). This object should be instantiated in the constructor. Remember (from assignment 1) an instance of the Bank class has a Vector of Customer objects. We will use this Vector (I’ll just refer to it as the Vector) a lot in this assignment.
Now add components which perform the following functionality.
• Two radio buttons labelled ‘add customer’ and ‘list customers’. Supply a default selection when the window opens up.
• A push button labelled ‘submit’. When this button is clicked then, depending on which radio button is selected, one of two dialogs should appear. You do not have to supply the dialogs in task 1. They will be described in later tasks.
• A push button labelled ‘exit’. Clicking this button should allow the program to exit without saving the current contents of the vector.
• A menu item labelled ‘open file’. Clicking this menu item will allow the user to open a currently saved file. The contents of this file should overwrite the current contents of the Bank’s contents of vectors. You do not have to supply this functionality in task 1. It will be described in a later task.
• A menu item labelled ‘save file’. Clicking this menu item will allow the user to save the current contents of the Vector to a file. The user should supply the filename that the contents will be saved to. You do not have to supply this functionality in task 1. It will be described in a later task.
• A menu item that performed the same functionality as the ‘exit’ push button.
Now make your program extend ActionListener. Provide code to handle the clicking of each menu item and push button. Fully implement the functionality of the exit button.
For the others, in task 1, it will suffice to simply have System.out.println statements which say what each button will do. For example,
System.out.println (“The add customer dialog will appear when this button is clicked!”);
You will provide functionality for these buttons in later tasks.