CIS 636 Fall 2002               Assignment 2 – Object Oriented Programming in Java – Creating a Class     100 points

Assigned: 02/05/2004

Due: 02/12/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 building one piece of a simplified EzPass toll collection program. The piece we are starting with is a simplified class to keep track of info for an EzPass Location  (I have called my class EzPassLocation). I imagine that we would LATER build EzPass classes for bridges and interchanges that are subclasses of EzPassLocation, and a class for Customers, that would have account balances, etc.  There might also, if necessary, at some time be a separate class for a specific Lane at a location.  This means that in the current class, things that would be in those other classes do not have to be put in this class; for instance here there is little or nothing to do with money.  You are to build the class, and also write a main program (probably part of the same class) that will test out the capabilities of the class (thoroughly).

The EzPassLocation class should be able to keep track of the name of the location, its actual location (city and state), the highway it is on, the number of lanes at the location, and the direction (N, S, E, W).  It should provide a variety of constructors, allowing users a variety of ways to create an EzPass Location.  It should provide all necessary accessors – inspectors and mutators, so that data can all be declared as private. Mutators should protect against bad data getting into objects (e.g. negative number of lanes, …).  The class should support versions of equals and toString appropriate to the class.

I encourage you to keep using my RedmondMsgInBasic and my RedmondMsgOut class for input and output. Cancels on input dialog boxes will not be fully handled until we cover exceptions.

  

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 deleting it from the c: drive.

 

 

Miscellaneous:

·        MAKE SURE YOUR PROGRAM WORKS! (i.e. more than just removing compile errors).  Make your class as robust as possible in preparation for future use.

·        Make sure that your main demonstrates that your class methods work.

·        Put YOUR NAME, and e-mail address and date 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.

·        For now (until we cover exceptions), we won’t catch invalid values that are the wrong type (e.g. letters where numbers are needed).