码迷,mamicode.com
首页 > 编程语言 > 详细

java3

时间:2015-10-21 20:45:57      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

package work1;
import java.util.*;
import java.text.*;
class Acount{
    String ID;
    String personID;
    String Name;
    String []TradeList=new String [1000];
    Date  Cdate;
    static int count=0;
    double balance;
    public Acount(String Name,String personID,String ID ){
        this.Name=Name;
        this.personID=personID;
        this.ID=ID;
        Cdate=new Date();
        this.balance=0;
        count=0;
    }
    public boolean put(double value){
        if(value>0){
            this.balance+=value;
            TradeList[count++]="+"+value;
            return true;
        }
        else return false;
    }
    public double get(double value){
        if(value>0){
            if(value<this.balance){
                this.balance-=value;
                TradeList[count++]="-"+value;
                return value;
            }
            else{
                value=this.balance;
                TradeList[count++]="-"+value;
                this.balance=0;
                return  value;
            }
        }
        return 0;
    }
    public void showTradeList(){
        System.out.println("交易明细如下:");
        for(int i=0;i<count;i++){
            System.out.println(TradeList[i]);
        }
    }
    public void DestroyAcount(){
        this.Name="";
        this.personID="";
        this.ID="";
        this.balance=0;
        for(int i=0;i<count;i++){
            TradeList[i]="";
        }
        this.count=0;
    }
}
----------------------------------------
package work1;
class Point{
    int x,y;
    public Point(){
        
    }
    public Point(int x,int y){
        this.x=x;
        this.y=y;
    }
    public Point(Point p){
        this.x=p.x;
        this.y-=p.y;
    }
    String ToString(){
        return "Point("+this.x+","+this.y+")";
    }
}
public class Pixel extends Point{
    private Color color;
    public static interface ColorConstant{
        int BLACK=0xff000000;
        int RED=0xffff0000;
        int GREEN=0xff00ff00;
        int BLUE=0xff0000ff;
        int WHITE=0xffffffff;
    }
    public static class Color implements ColorConstant{
        private int value,red,blue,green;
        public Color(int value){
            this.value=value;
        }
        public Color(int red,int blue,int green){
            this.red=red;
            this.blue=blue;
            this.green=green;
        }
        public Color(){
            this(BLACK);
        }
        private String  toRGBString(){
            return  "Color("+((this.value>>16)&0xff)+","+((this.value>>8)&0xff)+","+
                    ((this.value)&0xff)+"),0x"+Integer.toString(this.value,16);
        }
        
        
    }
    public Pixel(Point p,Color color){
        super(p);
        this.color=color;
    }
    public Pixel(Point p,int colorvalue){
        this(p,new Color(colorvalue));
    }
    public Pixel(){
        this(new Point(),new Color(ColorConstant.BLACK));
    }
    public String toString(){
        return this.getClass().getName()+"像素,坐标"+super.toString()+", 颜色"+
                this.color.toRGBString();
    }

java3

标签:

原文地址:http://www.cnblogs.com/linkzijun/p/4898670.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!