...

Computer Technology MSIS 22:198:605 Homework 4

by user

on
Category: Documents
3

views

Report

Comments

Transcript

Computer Technology MSIS 22:198:605 Homework 4
Computer Technology MSIS 22:198:605
Homework 4
Instructor: Farid Alizadeh
Due Date: Wednesday November 27, 2002 by midnight
Submission: by e-mail (See below for detailed instructions)
last updated on November 18, 2002
Rules:
Please note the following rules:
1. Assignments should be e-mailed on or before the day and time they
are due.
2. Late submission will result in loss of 25% of the points.
3. very important: It is not possible to pass this course if you miss more
than one programming assignment regardless of your scores in other
assignments or exams.
4. All programming projects should be submitted by e-mail. Put all the files
including all the .java and all the .class and .gif, .jpg and possible
input or output files in a single .zip file. The file name should
be in the following format:
LastnameFirstnameHWno.zip. For
example a student named Sally Jones submitting Home work
number 4 will have her file named: JonesSallyHW4.zip. To get a
zip archive file you can for instance download the PkZip software form
http://www.pkzip.com. You should e-mail your code as an attachment
to me at [email protected], with subject line MSIS605
HW4, exactly. Any deviation from this may result in delay in grading
your home work.
5. Every class that you define must be started with a comment that indicates
your name, student ID number, the home work number and your e-mail
address. For instance if Sally Jones is turning home work number 4 and
as part of her home work she has defined a class named investment then
this class will look something like this:
class investment{
1
MSIS 605, Fall 2002
Homework 4
//
//
//
//
Due date: 11/27/02
Name: Sally Jones
Student ID: 123456789
Home work no 4
e-mail: [email protected]
.... the rest of the program ...
}
2
MSIS 605, Fall 2002
Homework 4
Due date: 11/27/02
This home work is essentially a preparatory one, you will not be doing input
or output and are not even required to have a main method for this. There are
a few distinct things that you need to do.
First you need to use the sorting classes and methods along with their UML
diagrams that I described in class and add a new subclass of sorter class called
selectionSorter.
Next you need to define a set of classes all which deal with the problem
of defining credit worthiness of potential borrowers. For this homework, I just
need you to use the class diagrams using for instance argoUML. In the next one
or two home works, you will fill in the details of the code and, generate a GUI
interface to input the information Here are more details.
1
Add your selectionSorter to the objectiveSort
package
Using argoUML and the class diagrams for the objectiveSort class worked out
in class and posted in JavaCode Page, add a new subclass of the sorter class
called selectionSorter. Use argoUML and generate the skeleton code for this
class (make sure to put all the necessary additional methods such as findMin
etc in the class diagram of selectionSorter).
Next import the code you wrote in the last home work for selectionSorter
to the skeleton source code generated by argoUML. You need to remain faithful
to the code skeleton and only add code for inside the methods. I goes without
saying that you new version of selectionSorter should not assume anything
about the type of the objects it is sorting, and, consistent with the superclass
sorter class should only assume that an array of comparable objects are to be
sorted.
2
A credit rating package
The second part of your assignment is designing a package called creditPkg
involving several classes that cooperate together to estimate credit worthiness
of potential borrowers on a numerical scale. Below I describe these classes. For
this assignment you need to design these classes using argoUML. Only include
as much detail in these classes as specified below, nothing more or less. Some
classes are given only by name with no fields or methods specified, while others
may have considerably more detail. Also we will not discuss the constructors
for this assignment, leaving it for the next one.
Design the UML class diagram and include as much information as provides
plus any other necessary information that is implied from specification.
3
MSIS 605, Fall 2002
Homework 4
Due date: 11/27/02
The borrower Class
The central class in this package is the borrower class. There are a few different
types of borrowers and each one is composed of different types of objects that
together determine the borrower’s credit-worthiness.
The borrower class should be abstract because we will have, for now, two
different kinds of concrete borrowers: one class selfEmployedBorrower and the
other salariedBorrower.
The borrower class must have an abstract method called getCreditScore().
This method is overridden by subclasses using some formula (different formulas for different subclasses) to calculate a float number between 0 and 100.
The higher the number the higher creditworthiness. (For this assignment the
formulas will not be provided. They will be explained in the next assignment.
Each borrower should be composed of a number of components listed below:
The netWorth class:
This is a class containing fields: houseWorth (0 if rent, otherwise market value of
the residence); savings (containing all savings accounts and CD’s); investments
containing total market worth of all stocks and bonds including IRA and 401K
and other tax deferred retirement investments. and finally an array of other
types of holdings, that can accommodate thing such as cars, precious jewelry,
antiques etc. You need to define other as a static inner class that contains two
fields, name and value: Thus the name field may be "car" and the value field
may be $12,000. There should also be a method called getWorth() which is to
report the total worth. For this assignment you need not provide any code; just
let argoUML generate a skeleton code.
Note: You can use argoUML to add inner classes to a class. This is done
by going to the properties tab of the class and click on the icon for adding
inner class. However, when you generate the code this part is not generated by
argoUML (or at least I have not figured out how to do it yet.) Create the other
inner class the way you generate other classes. At the end, after generating the
code, you need to add the other class inside the netWorth class as a static inner
class, by cut and paste.
The incomeIF interface:
An income interface containing a single method called getIncome(). It is expected that at least two concrete income classes will realize this interface.
The salaryIncome class:
One type of income is for salaries. So you may wish to have a class called
salaryIncome implementing incomeIn interface. This class will have as its
fields the annual income and an array of bonuses, containing the last n years
bonus; n is another field to be determined dynamically.
4
MSIS 605, Fall 2002
Homework 4
Due date: 11/27/02
The cashFlowIncome class:
Another income type is for self-employed people called cashFlowIncome. This
will contain an array n incomes containing the last n years of income; again n is
determined dynamically. Again both these concrete income classes must have
getIncome() method which you need to leave empty for now.
The delinquencyIF interface:
This interface contains the single method getDelinquencyAmount(). This interface will have a number of concrete realizations. Among them are:
The missedPayment class:
for any kind of missed bill paying,
The bankruptcy class:
for any bankruptcies and
The foreclosure class:
for any real estate or business foreclosures.
The borrower abstract class itself is extended by two types of concrete
borrowers: salariedBorrower and selfEmployedBorrower.
The salariedBorrower class
must have as its income object a salaryIncome object.
The selfEmployedBorrower class
must have as its income incomeIn object.
We will write separate and essentially totally different codes to calculate the
credit worthiness of self employed and and salaried borrowers using their net
worth, investments, income, and potential delinquencies. For this assignment
however, you need to leave the body of these methods empty.
Finally we envision that borrowers will be sorted according to their credit
score. Therefore, the borrower class needs to implement the comparable interface of objectiveSort package and provide a compareTo() method that
compares the credit score of itself to another borrower’s credit worth.
3
What you need to turn in
You need to turn in the following:
1. the argoUML generated file for your the sorter class diagram (ending in
.zargo), including your modifications.
5
MSIS 605, Fall 2002
Homework 4
Due date: 11/27/02
2. the .java file for your new selectionSorter including the code for
sortIt and other methods in that class.
3. The argoUML file for the creditPkg package.
4. all the .java files generated by argoUML for the creditPkg classes and
with the modifications you made to them. For each modification you must
give an explanation using comments.
5. Put all these files in .zip file as before and e-mail them to me as an
attachment before the deadline.
4
Useful Reading
For creating packages and special care you need to take for compiling and running classes in user defined packages see section 8.5 of your text. You should
also read the sections of chapters 8 and 9 specified in the syllabus page.
6
Fly UP