MSCS 236: Assignment 02 (You Can Do in A Group of 2-3 Members)
MSCS 236: Assignment 02 (You Can Do in A Group of 2-3 Members)
Assignment 02
(You can do in a group of 2-3 members)
Total: 20 points
Due on Monday, February 15, 2016 at the beginning of class
How to submit the assignment?
Submission: -Soft copy of the Program using digital drop box of D2L
Objective
Upon completion of the following assignment, students will have very good knowledge
on:
Interface
Code reuse
areconsideredtoimprovethereuseofsoftware
areconsideredtoalleviatethesoftwareevolutionphase
arethoughtofbeingnaturalabstractionsofrealworldentities
arealworldentitycanbemodelled/implementedusingeithernotion
Objects
describe/implementrealworldentities(andtheirhierarchies)
mathematicalmodellingapproachtosoftware
partitionthestatespace
Components
describe/implementservicesofrealworldentities
engineeringapproachtosoftware
partitiontheservicespace
b) Mention differences between direct interface and indirect interface? How they can be
unified? (2+2=4 points)
Direct(procedural)interfaces:
+provideddirectlybyacomponentcorrespondingtointerfacesoftraditionallibraries.
+Definition&implementationbelongtoonecomponent.
Indirect(object)interfaces:
+providedbyobjectsimplementedbyacomponent,correspondingtoobjectinterfaces.
+Definition&implementationmightsitindifferentcomponents.
DirectandIndirectinterfacescanbeunifiedbymeansofstaticobjectsincomponents.
c) i) Discuss the issues, which were discussed in the class, for the evolution of versions
of a component (2 points)
ii) Discuss question 1 c-i) with your own knowledge and experience for additional
issues which are in addition to the issues discussed in the class. ( 2 points)
Interface changes should be minimal when the component evolves. There should be
minimal changes to external dependencies and non-functional (performance, reliability)
requirements for the component. If any of the above changes, then appropriate migration
strategy should be provided to the customer.
Problem Description
Design a Java Program based on the following specifications:
A SavingAccount gets interest the yearly with the same interest rate for at most
$1000. If the balance is more than $1000, the excess amount will have double
interest rate.
The CheckingAccount will have same interest rate for any balance, no matter
what the actual balance is.
Write a static method that uses polymorphism to compute the interest of any
Account. Supply a test program that tests classes and methods.
Skeleton
{
interest = amount*r;
}
else
{
interest = 1000*r + (amount-1000)*2*r;
}
return interest;
}
}
class CheckingAccount extends Account {
public CheckingAccount(String n, double r) {//write code here
super(n,r);
}
public double computeInterest(int amount) {//write code here
return amount*r;
}
}