标签:
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();
}
标签:
原文地址:http://www.cnblogs.com/linkzijun/p/4898670.html