.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> OOPS >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Java program bank details.

Posted By:laptop charles       Posted Date: June 30, 2010    Points: 10    Category: OOPS    URL: http://www.dotnetspark.com  

Bank details.
 

Using java to generate a simple bank interest generator.
//BANK DETAILS-CUTTENT ACCOUNT AND SAVINGS ACCOUNT
import java.io.*;
import java.lang.*;
import java.math.*;

class bank1

{
String cname;
int acno,type;
}
class curracc extends bank1
{
double p,intr,r;
int n;
double pin;
curracc(String xcname,int xacno, double xp,int xtype)
{
cname=xcname;
acno=xacno;
type=xtype;
p=xp;
r=0;
n=0;
}
void get(double amt,double rate,int yr)
{
p=amt;
n=yr;
r=rate;
System.out.println("principle"+p);
}
void cal()
{
intr=(p*(Math.pow((1.0+r),n)))-p;
p=p+intr;
System.out.println("interest:"+intr);
}
void withdraw(int want)
{
cal();
pin=p-want;

System.out.println("withdraw amt:"+want);

System.out.println("balance:"+pin);
display();
}
void dispaly()
{

System.out.println("customer name:"+cname);

System.out.println("acc no:"+acno);

System.out.println("acc type:"+type);
}
//CREATE A CLASS FOR SAVINGS ACCOUNT 
class saveacc extends bank1
{
double p,penalty,p1;
//CREATE A CONSTRUCTOR FUNCTION
saveacc(String xcname,int xacno,int xtype,double xp)
{
cname=xname;
axno=axno;
type=xtype;
p=xp;
penalty=0;
}
//CHECK THE PENALTY AMOUNT
{
void check(int chkamt)
{
if(p>chkamt) 
{
p1=p-chkamt;
if(p1>1000)
{
System.out.println("AMOUNT WITHDRAWN:''+chkamt);
System.out,println("BALANCE"+p1);
}
else
{
penalty+=100;
System.out.println("AMOUNT WITHDRAWN:"+chkamt);
System.out.println("BALANCE:"+p1);
System.out.println("PENALTY;"+penalty);
}
}
if(chkamt>p)
{
System.out.println("U R ACCESS BELOW PRINCIPLE AMOUNT");
System.out.println("U PRINCIPLE AMOUNT IS LESS THEN MINIMUM AMOUNT");
p1=p;
}
}
void putamt(int pamt)
{
p=p1+pamt;
display();
}
//
System.out.println("CUSTOMER NAME:"+cname);
System.out.println("ACCOUNT NUMBER:"+acno);
System.out.println("ACCOUNT TYPE:+type");
System.out.println("PRINCIPLE:"+p);
}
}
class bank
{
public static void main(String arg[])throws IOException
{


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend