This assignment adds methods to the SimpleList class and then uses that class to store and make changes to a collection of BankAccounts. Your program must not have any memory leaks.

Your program will consist of:

  • the BankAccount class used in the Feb.19 lab - no changes are needed
  • the SimpleList class from the Feb.26 lab with the following additions/changes
    • change ElementType from int to BankAccount*
    • add to the display method a line that sends the size of the SimpleList to the output stream
    • add a method to remove the element at position i void remove(int position);
    • add a method to get the element at position i ElementType get(int position)const;
    • add a destructor ~SimpleList();
    • add a copy constructor SimpleList(const SimpleList & listToCopy);
    • add an assignment operator SimpleList& operator=(const SimpleList & listToCopy);
    • At the beginning of each of the big 3 methods put a line that sends to cout a message indicating that the method has been called.
  • a well decomposed program that does the following:
    • creates an empty SimpleList
    • opens a file that contains a list of commands to be executed. The possible commands are: add a BankAccount at a position (A name balance position) remove the BankAccount at a position (R position) deposit an amount to the BankAccount at a position (D amount position) withdraw an amount from the BankAccount at a position (W amount position) display the name and balance of all the BankAccounts in the SimpleList (O)
    • the last thing the program should do is to call a function that tests the big 3 methods. You may use the function shown below to do this:
void testBig3(SimpleList sl){
SimpleList newSL;
newSL.insertAt(new BankAccount("John", 90), 0);
newSL = sl;
newSL.insertAt(new BankAccount("Mary", 50), 0);

An example of a file containing commands to be executed follows:

A Margaret 50 0
A Itai 250 0
A Yagmur 150 1
D 25 1
W 50 1
D 100 2
R 2
R 0

The output from processing these commands should look something like:

Number of accounts: 3
Itai 250
Yagmur 150
Margaret 50

Number of accounts: 3
Itai 250
Yagmur 125
Margaret 150

Number of accounts: 1
Yagmur 125

When your program is graded it will be run with the valgrind tool which will check to see if your program creates any memory leaks. It is strongly recommended that you run your program with valgrind. The use of valgrind will be covered in lab on March 5.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.