Exercise B.docx (11K) - Student of Fortune

looneyvillestaticΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 8 χρόνια και 11 μήνες)

525 εμφανίσεις

This exercise modifies the Future Values application so that it uses classes that provide static

1) Open the FutureValuesValidationApp class and save it into another directory, then change its
class name to FutureValuesApp.

2) Start a new
class named Validator and save it on the same directory. Move the getDouble,
getDoubleWithinRange, getInt, and getIntWithinRange methods into the Validator class. Next,
change the name of the getDoubleWithinRange method to getDouble, and change the name
the getIntWithinRange method to getInt. This overloads the getDouble and getInt methods.
Then, compile this class.

3) Modify the FutureValueApp class so it uses the methods in the Validator class. Then,
compile and run that class to make sure that
it works correctly.

4) Start a new class named FinancialCalculations, and save it in the same directory as the other
classes. Move the calculateFutureValue method from the FutureValueApp class to the
FinancialCalculations class, and make sure that the
method is public. Then, compile this class.

5) Modify the FutureValuesApp class so it uses the static calculateFutureValue method that’s
stored in the FinancialCalculations class. Then, compile and run this class to make sure that the
application still

works properly.

To get credit, you have to make sure this:

** contains Validator class that compiles correctly

** Validator contains overloaded getInt method

** Validator contains overloaded getDouble method

** FutureValuesApp class uses overloaded Valid
ator methods

** Contains FinancialCalculations class that compiles correctly

** FinancialCalculations contain static calculateFutureValue method

** FutureValueApp class uses static calculateFutureValue method