Question
modify the CheckingAccount class to add the following instance members: an array (self-expanding type) or ArrayList of Transaction objects and a int variable transCount (incremented
modify the CheckingAccount class to add the following instance members: an array (self-expanding type) or ArrayList of Transaction objects and a int variable transCount (incremented each time a new Transaction object is created). Create a Transaction class that stores an int transNumber (will be the current value of transCount), an int transId (1 = check, 2 = deposit 3 = service charge) and a double transAmt. Prompt the user for the choice of a) entering a transaction, b) listing all transations, c) listing all checks, d) listing all deposits.(implement these options with JFrame,JLabel, JRadioButton, ButtonGroup, and a listener) The listings must go to a Dialog box. Add instance methods to the CheckingAccount class like addTrans (put a trans into the account), getTrans (get a transaction from the array) getTransCount(get the current value of transCount class variable) and any other methods you wish to implement. This program is event-driven. You cannot put all the processing steps/logic in main. You can put them in helper methods in the Main class, in the GUI objects class, or in the CheckingAccount class, so they can be called by the listener method.
Code Template The following code template will help with this assignment: New data and methods for the CheckingAccount Class --------------------------------------------------------------------------- private ArrayList transList; // keeps a list of Transaction objects for the account private int transCount; // the count of Transaction objects and used as the ID for each transaction public void addTrans( Transaction newTrans) // adds a transaction object to the transList public int gettransCount() //returns the current value of transCount; public Transaction getTrans(int i) // returns the i-th Transaction object in the list
New Transaction class -------------------------------------------------------------------------- public class Transaction { private int transNumber; private int transId; private double transAmt; public Transaction(int number, int id, double amount) { transNumber = number; transId = id; transAmt = amount; } public int getTransNumber() { return transNumber; } public int getTransId() { return transId; } public double getTransAmount() { return transAmt; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started