CS 162 Spring 2000 Assignment 8 –List Internals
100 pointsAssigned: 04/10/2000
Due: 04/17/2000 at the start of class.
Pairs: You may work in pairs if you want. Note, during the course of the semester, you cannot pair with any one person more than twice. If you work in a pair, turn in ONE copy that is the work of both of you, with both of your names on it. Each member of the pair will receive the same grade for that lab.
Main Assignment
:You will update the AccountList class that that is patterned after Budd’s slist.h simple list template, and write a main that demonstrates the capabilities of your functions. (the list AccountList.h and .cpp and the AccountLink.h and .cpp and the Account.h and .cpp files on my WWW page are necessary for this assignment). Your additions to the AccountList class should be member functions/operators:
Details
:0) Your functions can, and in many cases should, make use of other functions provided by the classes involved (and remember that AccountList is a friend of AccountLink, so can use the private parts of AccountLink).
Hand-in
:1) Listing of the program
2) Disk with all relevant .h and .cpp files, plus your .exe file. NAME YOUR CLIENT FILE yourlastname8.cpp Name your project yourlastname8 so that the executable will be yourlastname8.exe. If you are working in pairs, use both last names (e.g. redmondsmith8.cpp)
Miscellaneous
:1) If you have any questions about what should be done, please ask!!
2) MAKE SURE YOUR PROGRAM WORKS! (i.e. more than just removing compile errors).
3) Remember: Indentation, meaningful variable names, symbolic constants, and meaningful comments. Weaknesses in any of these could result in points off. Also make sure you put YOUR NAME(s), section, and e-mail address in comments at the beginning of the program.
Sample Interaction:
create empty lists and show them
myList has 0 elements
myOtherList has 0 elements
Waiting for you - type char and return>
dshow two lists with random acct#s and random deposits
myList has 5 elements
Acct# 1740 Bal: 1169
Acct# 7614 Bal: 1902
Acct# 7954 Bal: 703
Acct# 7931 Bal: 1529
Acct# 0900 Bal: 1006
myOtherList has 5 elements
Acct# 4551 Bal: 827
Acct# 6857 Bal: 1726
Acct# 4113 Bal: 868
Acct# 2860 Bal: 942
Acct# 3446 Bal: 1840
Waiting for you - type char and return> d
test += operator - show that myList has changed and myOtherList has not
myList has 10 elements
Acct# 1740 Bal: 1169
Acct# 7614 Bal: 1902
Acct# 7954 Bal: 703
Acct# 7931 Bal: 1529
Acct# 0900 Bal: 1006
Acct# 4551 Bal: 827
Acct# 6857 Bal: 1726
Acct# 4113 Bal: 868
Acct# 2860 Bal: 942
Acct# 3446 Bal: 1840
myOtherList has 5 elements
Acct# 4551 Bal: 827
Acct# 6857 Bal: 1726
Acct# 4113 Bal: 868
Acct# 2860 Bal: 942
Acct# 3446 Bal: 1840
Waiting for you - type char and return> d
test getNth functions
Using GetNthAccount - myOtherList Account: 0 Acct# 4551 Bal: 827
Using GetNthAccount - myOtherList Account: 1 Acct# 6857 Bal: 1726
Using GetNthAccount - myOtherList Account: 2 Acct# 4113 Bal: 868
Using GetNthAccount - myOtherList Account: 3 Acct# 2860 Bal: 942
Using GetNthAccount - myOtherList Account: 4 Acct# 3446 Bal: 1840
Using GetNthAccountLinkPtr - myOtherList Account: 0 Acct# 4551 Bal: 827
Using GetNthAccountLinkPtr - myOtherList Account: 1 Acct# 6857 Bal: 1726
Using GetNthAccountLinkPtr - myOtherList Account: 2 Acct# 4113 Bal: 868
Using GetNthAccountLinkPtr - myOtherList Account: 3 Acct# 2860 Bal: 942
Using GetNthAccountLinkPtr - myOtherList Account: 4 Acct# 3446 Bal: 1840
Waiting for you - type char and return> d
test remove function - show that myList has changed (element 7 gone) and myOtherList has not
remove ok: 1
myList has 9 elements
Acct# 1740 Bal: 1169
Acct# 7614 Bal: 1902
Acct# 7954 Bal: 703
Acct# 7931 Bal: 1529
Acct# 0900 Bal: 1006
Acct# 4551 Bal: 827
Acct# 6857 Bal: 1726
Acct# 2860 Bal: 942
Acct# 3446 Bal: 1840
myOtherList has 5 elements
Acct# 4551 Bal: 827
Acct# 6857 Bal: 1726
Acct# 4113 Bal: 868
Acct# 2860 Bal: 942
Acct# 3446 Bal: 1840
Waiting for you - type char and return> d
test remove function special cases - show that myOtherList has changed (first and last elements gone)
myList has 9 elements
Acct# 1740 Bal: 1169
Acct# 7614 Bal: 1902
Acct# 7954 Bal: 703
Acct# 7931 Bal: 1529
Acct# 0900 Bal: 1006
Acct# 4551 Bal: 827
Acct# 6857 Bal: 1726
Acct# 2860 Bal: 942
Acct# 3446 Bal: 1840
myOtherList has 3 elements
Acct# 6857 Bal: 1726
Acct# 4113 Bal: 868
Acct# 2860 Bal: 942
Waiting for you - type char and return> d
test sort - show that myList has changed and myOtherList has not
myList has 9 elements
Acct# 7614 Bal: 1902
Acct# 3446 Bal: 1840
Acct# 6857 Bal: 1726
Acct# 7931 Bal: 1529
Acct# 1740 Bal: 1169
Acct# 0900 Bal: 1006
Acct# 2860 Bal: 942
Acct# 4551 Bal: 827
Acct# 7954 Bal: 703
myOtherList has 3 elements
Acct# 6857 Bal: 1726
Acct# 4113 Bal: 868
Acct# 2860 Bal: 942
Waiting for you - type char and return> d