Try to write a simple bank storage applet, just a kernel idea. If you want to complete all the features, then you need to gradually improve, the code is as follows:
Public Class Test
{
Public static void main (string args [])
{
Boolean blue = false;
FLOAT MONEY = 0.00F;
String xx;
Demo Impl = new demo ();
Blue = Impl.Regname ("Wenyu1314", 12,8000.0f);
IF (blue)
{
System.out.println ("Good Luck! You Have 8000 $ / N");
System.out.println ("UserName:" Impl.userName);
System.out.println ("UserID:" Impl.userid);
System.out.Println ("Money:" Impl.money);
System.out.println ("----------------------------------------- ---------------- ");
}
Else
System.out.println ("Sorry !! this is system's worng");
Blue = IMPL.DEPOST (500);
IF (blue)
System.out.println ("Good Luck!");
Else
System.out.println ("Sorry !! this is system's worng1");
Money = Impl.Retive (12, 20.0f);
IF (Money! = 0.0F)
{
System.out.println ("Good Luck!");
System.out.println ("You Have Money Is:" Impl.money);
}
Else
System.out.println ("Sorry !! this is system's worng2);
FLOAT MONEY1 = 0.0f;
Blue = IMPL.GETUSERID (12);
IF (blue)
System.out.println ("OK! You ID is Money:" Impl.money);
Else
System.out.println ("Sorry Is Not this UserId);
}
}
Interface Conner
{
Boolean RegName (String UserName, Int Userid, Float Money);
Boolean Depost (FLOAT MONEY);
Float Retive (int Userid, Float Money);
Boolean getUserid (int userid);
}
Class Demo Implements Conner
{
String username;
INT userid;
FLOAT MONEY;
PUBLIC DEMO () {};
Public Demo (String UserName, Int Userid, Float Money)
{
THIS.USERNAME = UserName;
THIS.USERID = UserId;
THIS.MONEY = MONEY;
}
Public Boolean RegName (String UserName, Int Userid, Float Money) {
THIS.USERNAME = UserName;
THIS.USERID = UserId;
THIS.MONEY = MONEY;
Return True;
}
Public Float Retive (int Userid, Float Money)
{
IF (userid == this.userid)
Return Money;
Else
Return 0.00F;
}
Public Boolean Depost (FLOAT MONEY)
{
THIS.MONEY = MONEY;
Return True;
}
Public Boolean getUserId (int userid)
{
IF (userid == this.userid)
Return True;
Else
Return False;
}
}
Listening to a master, there are a lot of interface, the writing program is inseparable from the interface, so I record it to prevent the day, I forgot ^ _ ^
This applet written today also understands that most of the data stock data is through array
I don't know where to think, 嘿嘿 ...
Have time to write a small database