CIS 636 Spring 2004                                    Assignment 5 – Interfaces (not GUI) in Java                      100 points

Assigned: 03/11/2004

Due: 03/18/2004 at the start of class 

 

You may work individually or in pairs for this assignment. But all work must be the work of the person/people whose name is on the code! If working in pairs, the individual contributions should be relatively equal. One possibility is to work together tonight, then finish separately (to avoid communication difficulties).

 

Main Assignment:

We are going to add the use of Interfaces to the Customer part of the EZPass project (admittedly in a way that is fairly simplified).  Specifically, you will be 1) in a new test driver, or in the main() used to test the Customer class, create and fill an array of Customers. This code can probably be copied from your main() from Assignment 4; 2) creating a method to find the largest Comparable object in an array of Comparable objects – this may be in its own package and class; It MUST be general – it should make NO mention of customers. I should be able to use it on ANY Comparable object; 3) Make Customer a Comparable class, so that it can be used with the find largest. This includes, adding method(s) necessary for any Comparable class.  Let’s use current balance as the determination of which customer is larger. Optional – in case of tie, use replenishment amount as tie breaker;  4) Have your main() make use of the find max method in order to find the highest balance customer. You may also want to try using my insertSort method on your array of Customers, since you can now do that, and it is easy (one line of code). 

  

Hand in:

 

To avoid needless long waits, I recommend working on this on the c: drive, then upon completion, copying it to the a: drive, testing it there, creating an extra backup for yourself, then (if working in lab) deleting it from the c: drive.

 

 

Miscellaneous:

·        Test your work on more than one case – e.g. find the max customer, then do some activity on the customers and find the max again …

·        The find max method is probably a static method since it doesn’t really apply to an object.

·        My insertSort static method is available in my Sorts.java file that can be found under simple examples under review on my www page.

·        Put YOUR NAME, and e-mail address, date, AND where to mount filesystem in the IDE,  in comments at the beginning of the program.

·        Also, comment any significant code to document it (each method, each loop, each if, and each significant calculation should have a comment. In particular, each method needs to have a JAVADOC compatible comment).

·        Indent code following standard conventions (indent to show that something is “inside” or “part of” the preceding code (e.g. inside if’s or loops, or statements continued on a new line).  The IDE should handle this if you hit ENTER and move on to the next line (If you make changes, you may need to TAB to make things right).

·        Name your variables meaningfully, to describe their use in the program.