Term Paper

Only available on StudyMode
  • Download(s) : 24
  • Published : March 10, 2013
Open Document
Text Preview
01. What is inheritance?
02. What are the difference between method overriding and method overloading? Explain with example? 03. What is the advantage of method overriding?
04. What is interface? What are the possible contents of an interface? Explains.

Accounts
Accounts
05.

Current Account
Current Account
Saving Account
Saving Account

You have to design a class contains hierarchy as shown below: The parent class contains the general information about an account and an abstract method to calculate the yearly interest. For saving account, the interest rate is 10% and for current account the interest rate is 6%. All the data members of the Account class are initialized though a parameterized constructor. Your program should be able to deposit and withdraw money from a saving account. Perform the same operations on a current account.

06. Draw a Diagram to represent a class called “Bank Account” with the attribute balance (of type int) and methods depositMoney(). Show appropriate visibility modifiers. 07. Draw a diagram to represent a class called ‘Catalogue’ and a class called ‘ItemFor Sale’ as define below: ‘ItemFor Sales has an attribute ‘name’ of tyoe string an attribute’ price’ of type int. It also has a method setPrice() which makes an integer parameter’newPrice’. ‘Catague’ has an attribute ’listOfItems’ i.e. the item currently held in the catalogue. As zero or more items can be stored in the catalogue ‘listOfItems’ will need to be an array or collection. ‘Catalogue’ also has one method addItem() which takes an ‘Item’ as a parameter(type ItemForSale) and add this Item to the ‘listOfItems’. Draw this on a class diagram showing appropriate visibility modified or attribute and methods.
tracking img