please sollution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vijay86
    New Member
    • Apr 2007
    • 1

    #1

    please sollution

    All information about all classes
    Abstract Account
    Public String getcustomername ();
    Public void set customername();
    Public double getamount();
    Public void setamount();
    Public double getwidrawalamou nt();
    Public void set widrawalamount( );
    Abstract String toString();

    Saving Account
    public void deposit ( );
    public void withdrawal ( );
    public void addInterest ( );
    public String toString ( );
    public void listTransaction s ( );
    public void printBalance ( );
    public String toString();

    ChequeAccount
    public void deposit ( );
    public void withdrawal ( );
    public String toString ( );
    public void listTransaction s ( );
    public void printBalance ( );
    public String toString();



    Final Analysis
    The main aim of this system is to provide all description about account detail. The subclasses of Account class are Saving account and Cheque Account. There are also same methods as a saving class but not intrest method to calculate interest of amount. double balance; String accountNo; Vector transactions are main instance variables of Saving account. All methods related in this class are useful for deposit, withdrawal and add interest. double balance; String accountNo; Vector transactions; SavingsAccount savingsLink are main varibals of ChequeAccount class.



    This assignment involves writing a program to record transactions for bank customers. The bank
    handles customer accounts according to the following rules:
    • Each customer of this bank has exactly two accounts – one a savings account and one a
    cheque account.
    • Savings accounts and cheque accounts both accept deposits in the same way.
    • Savings accounts and cheque accounts both print the current balance in the same way.
    • All accounts allow withdrawals.
    • To withdraw from a savings account there must be sufficient funds in that account.
    Otherwise the withdrawal does not proceed.
    • To withdraw from a cheque account there must be sufficient funds in that account. If
    there are not sufficient funds then the bank attempts to withdraw the shortfall from the
    savings account. If there are still not sufficient funds, the withdrawal does not proceed.
    • At the end of the month, the bank adds 5% interest to the final balance of the savings
    account.
    • Every deposit, withdrawal and interest payment is logged as a transaction.
    • At the end of every month, the bank issues a statement for each bank account.

    Task A
    Create a design for your program from the following specifications:
    • The program requires you to create four concrete classes – Customer, SavingsAccount,
    ChequeAccount, Transaction.
    • The program also requires you to create an abstract class called Account from which
    SavingsAccount and ChequeAccount both inherit.
    • SavingsAccount and ChequeAccount could have the following class diagrams (minus the
    set and get methods which you will be required to supply).
    TP1, 2007 Subject: CP627 Programming 2- Assignment 1
    E:\CP627_Sunam\ Assignment1\CP6 27_Assign1_TP1_ 07.rtf Page 2 of 4
    CRICOS Provider Number 00103D
    SavingsAccount ChequeAccount
    double balance
    String accountNo
    Vector transactions
    double balance
    String accountNo
    Vector transactions
    SavingsAccount savingsLink
    public void deposit ( )
    public void withdrawal ( )
    public void addInterest ( )
    public String toString ( )
    public void listTransaction s ( )
    public void printBalance ( )
    public void deposit ( )
    public void withdrawal ( )
    public String toString ( )
    public void listTransaction s ( )
    public void printBalance ( )
    • Create a third class diagram for Account. Both SavingsAccount and ChequeAccount
    inherit from Account. Determine what instance variables and methods will be
    encapsulated within Account and include them within the class diagram. Adjust
    SavingsAccount and ChequeAccount accordingly. Pay particular attention to the method

    withdrawal which exists in both SavingsAccount and ChequeAccount but is implemented

    differently in both. It will also be necessary to determine what access specification each

    member should now be given.
    • The class diagrams (not including the appropriate get and set methods) for Customer
    and Transaction are:
    Customer Transaction
    String name
    String address
    SavingsAccount savings
    ChequeAccount cheque
    double amount
    int typeOfTransacti on
    public String toString public String toString ( )

    Task B

    • Create a project name after your student ID.
    • Write code to implement all five classes (be sure to include the appropriate get and set
    methods).
    • Provide appropriate constructors for the classes.
    TP1, 2007 Subject: CP627 Programming 2- Assignment 1
    E:\CP627_Sunam\ Assignment1\CP6 27_Assign1_TP1_ 07.rtf Page 3 of 4
    CRICOS Provider Number 00103D

    Task C

    • Create a driver class called Assign1Demo.
    • Author a method within the Assign1Demo class called readCustFile. This method should
    read the text file Customer.dat (supplied) line by line. Each line of Customer.dat contains
    two strings – the name of a Customer and this Customer’s address. For each line of
    Customer.dat create a new Customer object and initialise it with the data from this line.
    Each new Customer object should be placed into a Vector called customers (an instance
    variable of Assign1Demo).

    • Create a method called testBankAccount s should perform the following tasks:
    It opens a file called transactions.da t. It reads this file one line at a time
    Each line of transactions.da t consists of four data fields:
    1. The first field is an integer which indicates the position in the customers
    Vector that the Customer object is located. The transaction being
    undertaken refers to this Customer
    2. The second field is a string which indicates which account the transaction
    refers to

    3. The third field is a string indicating whether the transaction is a deposit or
    a withdrawal

    4. The fourth field is a double indicating the amount of the transaction
    • For each line of transactions.da t perform the transaction indicated

    • Note: You must not assume the number of lines in either input file. For instance, you
    must not count the number of lines in Customer.dat and program accordingly.

    • After these tasks have been completed the program should assume it is the end of the
    month and perform the tasks associated with that time. Create a method called

    endOfMonth to do this. Ensure that all output is appropriately set out. Output should be
    sent to a file called endOfMonthTrans actions.

    • The Assign1Demo class should have a main method which drives the program. It should
    create an Assign1Demo object, invoke readCustFile, followed by testBankAccount s,
    followed by endOfMonth.
    D
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    I'd say that's a nice assignment; start designing right away and then start
    coding. When you're stuck with something please feel free to ask a specific
    question here and we'll try to help you out.

    good luck and

    kind regards,

    Jos

    Comment

    Working...