The following guidelines are expected for all homework submissions:
all over the mapon *my* computer or in my editor. USE SPACES INSTEAD. You can set up almost every modern text editor to insert spaces whenever you press the TAB key, or you can simply pound the spacebar.
pair programmingwhich is part of the Extreme Programming software development method. Feel free to collaborate in your pairs as much as you want, doing the entire assignment together.
main
method in your source code with lots of test cases; 4) practice
adding new methods into an existing program; 5) practice determineing and adding expanded test cases
to cover the added methodsYou will be using the HighArray.py
class from my repo for this homework assignment. The class
uses alist and demonstrates insertion, deletion, and location operations. The implementation is not
too difficult. The base class file is given to you, along with a basic tester which is a separate
file that contains the main method for this program, called HighArrayTest.py
. Your task is to
use these two classes to implement the following projects.
There is an evaluation rubric in my repo in the homework02 directory that you can use to see what is expected for this assignment. Take a look at it so you won't be surprised by anything.
HighArray.py
source file by navigating to my GitHub repo and then
downloading a copy of the file called HighArrayEmpty.py
. Rename your copy to be
HighArray.py
. Be sure to use good coding practices to make your code pretty, artful,
professional, and maintainable. Starting with the existing code will make this assignment much
easier, but if you would like to do it on your own, I don't want to rain on your parade.
HighArrayTest.py
file in the same way, downloading the initial file from
my repo. Run that source as well, to make sure there are no errors. NOTE THIS IS A SEPARATE FILE
– don't include this code in the same file as HighArray.py
!
HighArrayTest.py
file and in the import
line at the top, change
the from HighArrayEmpty import HighArrayto be
from HighArray import HighArray. This will make sure the tester will use your copy of the
HighArray.py
code.
HighArray.py
code to print the list. Name your function display()
.
Test it to make sure it displays the values in the list by running the tester.
HighArray.py
program, add a function called getMax()
that
returns the value of the highest item in the array, or –1 if the array is empty. Add some
code in the main()
method in the HighArrayTest.py
program to test this
function. You can assume all the list indices are positive numbers. Add AT LEAST
FIVE new test cases, which means you will need to add or remove values from the array
between calls to the getMax()
tests. Also make sure to test on an empty list!
noDupes()
function for the HighArray.py
class. This method
should remove all duplicates from the list. That is, if three items with the value 17
appear in the list, noDupes()
should remove two of them. Don't worry about
maintaining the order of the items. Feel free to do some further research on this and see if you
can find an 'elegant' way to do it. If not, brute force is fine.