1
36kviews
(a) Assume that a bank maintains two kinds of accounts for customers, one called as savings account and the other as current account.

The saving account provides compound interest and withdrawal facilities but no cheque book facility. The current account provides cheque book facility but no interest. Current account holders should also maintain a minimum balance and if the balance falls below this level, a service charge is imposed. - Class account stores customer name, account number and the type of account. - Include member functions:- - - Accept deposit from a customer and update the balance - Display the balance - Compute and deposit interest - Permit withdrawal and update balance - Check for minimum balance, impose penalty and update the balance

Draw Class diagram for above scenario. . -

(b) For above problem statement, implement class account, current account and saving account. - (c) Explain association and aggregation with suitable example. - Marks: 4 M, 8 M

Year: Dec 2013

1 Answer
2
811views

(a)

enter image description here

(b) For above problem statement, implement class account, current account and saving

class Account
{
    String cust_name;
    int acc_no;
    double balance;
    String type_of_account 
    public void withdraw()
    {
    }
    public void deposit()
    {
    }
    public void display()
    {
    }
    public void updateBal()
    {
    }
}
class Current extends Account
{
    double servicecharge;
    String chequebook;

    public void issueCheque()
    {
    }
    public void checkBal()
    {
    }
    public void imposePenalty()
    {
    }
}
class Saving extends Account
{
    double interest;
    public void computeInterest()
    {
    }
    public void depositInterest()
    {
    }   
}

(c) Explain association and aggregation with suitable example.

Association:

  • When a classes are connected together conceptually, that connection is called an association.
  • When one class associated with another, each one usually plays a role within that association.
  • One can show each class’s role by writing it next to the class. Here is an example:
  • The association between a player and a team, we can call this association as “player plays for a team”.

We can create the association by drawing a line between two classes and writing name over it.

enter image description here

  • There can be more than one association between the two classes. For example, if the team is professional, it’s an employer and the player is an employee. Then the diagram can be drawn as:

enter image description here

Aggregation:

  • Sometimes, a class consists of a number of component classes. This type of relation between class and its various components is called as aggregation.
  • The components and the class they constitute are in a part-whole association.
  • For example, a desktop computer system is an aggregation that consists of a CPU box, a keyboard, a mouse, a monitor, a CD-ROM drive, a hard drive, a RAM, a graphics card, a sound card and probably more items.
  • We can represent an aggregation as a hierarchy with the whole class as computer system and components below it.
  • A line joins a whole to a component, with an open diamond on a line near the whole.

enter image description here

Please log in to add an answer.