Java Data Objects (JDO)

Creating a Simple Banking Application

Gopalan Suresh Raj

Note
To work with any of these samples, you will need the following:
.........................................JDK 1.2 or higher (I use JDK 1.3.1)
.........................................PE:JTM - The Productivity Environment for JavaTM (from HYWY Software Corporation)

 

The following file should be located in the Classes Folder that you identified in PE:J

com/hywy/samples/bank/Savings.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
package com.hywy.samples.bank;


/**
*  Class Description for Savings.java
*
*  @author: gopalan
*  @created date: Apr 16, 2002
*  @last modified date:
*  @version:
*
*/

public class Savings  extends Account {

  /** Attribute   interestRate_ */
  private int interestRate_  ;

  /** Constructor */
  public Savings() {
    super();
    ///////////////////////////////////////////
    //// Start of User's Business Logic    ////
    ///////////////////////////////////////////
    this.accountType_ = SAVINGS_ACCOUNT_;
    ///////////////////////////////////////////
    ////   End of User's Business Logic    ////
    ///////////////////////////////////////////    
  }


  /** Methods Description */
  public int  calculateInterest(  )  throws   java.lang.Exception {
    //return 0;
    ///////////////////////////////////////////
    //// Start of User's Business Logic    ////
    ///////////////////////////////////////////
    if(this.accountType_ != SAVINGS_ACCOUNT_) {
      throw new Exception("Invalid Account Type :"+this.accountType_);
    }
    return this.balance_*this.interestRate_/100;
    ///////////////////////////////////////////
    ////   End of User's Business Logic    ////
    ///////////////////////////////////////////  
  }

  /** Setter Method for field --> interestRate_*/
  public void  setInterestRate_(   int newInterestRate_   ) {
    interestRate_ = newInterestRate_;
  }

  /** Accessor Method for field --> interestRate_ */
  public int  getInterestRate_(  ) {
    return interestRate_;
  }

  /** Default toString() method */
  public java.lang.String  toString(  ) {
    StringBuffer strBuff = new StringBuffer();

    strBuff.append(super.toString());
    strBuff.append(" Savings: ");
    strBuff.append(" interestRate_= " + interestRate_);

    return strBuff.toString();
  }
}

 

click here to go to
My JDO HomePage...

click here to go to
My Advanced Java Tutorial Page...

About the Author...
Gopalan Suresh Raj is a Software Architect, Developer and an active Author. He has co-authored a number of books including "Professional JMS", "Enterprise Java Computing-Applications and Architecture" and "The Awesome Power of JavaBeans". His expertise spans enterprise component architectures and distributed object computing. Visit him at his Web Cornucopia© site (https://gsraj.tripod.com/) or mail him at gopalan@gmx.net.

Go to the Component Engineering Cornucopia page

This site was developed and is maintained by Gopalan Suresh Raj

This page has been visited times since February 26,2002.

Last Updated : Feb 26, 2002

If you have any questions, comments, or problems regarding this site, please write to me I would love to hear from you.


Copyright (c) 1997-2002, Gopalan Suresh Raj - All rights reserved. Terms of use.

All products and companies mentioned at this site are trademarks of their respective owners.