資源簡介
1. 賬戶類(滿分50分)
版本1:滿分10 分
設計Account1 類,包含:
■ 一個名為 id 的int 類型的私有數據域(默認值為 0),長度為 6 位。
■ 一個名為 balance的double 類型的私有數據域(默認值為 0)。
■ 一個名為 annualInterestRate 的double 類型的私有數據域存儲當前利率(默認值為 0)。
假設所有的賬戶都有相同的利率。
■ 一個名為 dateCreated 的Date 類型的私有數據域存儲賬戶的開戶日期。
■ 一個能創建默認賬戶的無參構造方法。
■ 一個能創建帶特定 id 和初始余額的
代碼片段和文件信息
/**
?*?
?*/
import?java.io.Serializable;
import?java.text.DecimalFormat;
import?java.util.Date;
/**
?*?@class?name?Account1
?*?@author?X-Hay
?*?@CQUT
?*?@UP.
?*/
public?class?Account1?implements?Serializable?{
protected?int?id;
protected?double?balance;
protected?static?double?annualInterestRate;
protected?Date?dateCreate;
static?DecimalFormat?df?=?new?DecimalFormat(“#.00“);
public?Account1()?{
id?=?100000+(int)Math.random()*10000;
balance?=?0;
dateCreate?=?new?Date();
annualInterestRate?=?0;
}
//if?the?initial?balance?is?negative?throw?exception
public?Account1(int?id?double?balance)?{
this.id?=?id;
if(balance>=1e-10){
this.balance?=?Double.parseDouble(df.format(balance));
}else{
throw?new?IllegalArgumentException(“Initial?ba
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????301??2013-07-06?21:51??Account\.classpath
?????文件????????383??2013-07-06?21:51??Account\.project
?????文件?????????52??2013-07-08?13:16??Account\.reverse.properties
?????文件????????629??2013-07-06?21:51??Account\.settings\org.eclipse.jdt.core.prefs
?????文件???????5247??2013-08-09?15:56??Account\.settings\org.eclipse.jdt.ui.prefs
?????文件????????829??2013-08-14?21:51??Account\accounts.dat
?????文件???????2103??2013-08-27?09:49??Account\bin\Account1.class
?????文件???????2727??2013-08-27?09:49??Account\bin\Account2.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$1.class
?????文件????????979??2013-08-27?09:49??Account\bin\ATM$10.class
?????文件????????979??2013-08-27?09:49??Account\bin\ATM$11.class
?????文件????????980??2013-08-27?09:49??Account\bin\ATM$12.class
?????文件???????2648??2013-08-27?09:49??Account\bin\ATM$13.class
?????文件???????1115??2013-08-27?09:49??Account\bin\ATM$14.class
?????文件???????1998??2013-08-27?09:49??Account\bin\ATM$15.class
?????文件???????3283??2013-08-27?09:49??Account\bin\ATM$16.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$2.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$3.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$4.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$5.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$6.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$7.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$8.class
?????文件????????977??2013-08-27?09:49??Account\bin\ATM$9.class
?????文件???????7339??2013-08-27?09:49??Account\bin\ATM.class
?????文件???????1825??2013-08-27?09:49??Account\bin\ATMMachinel.class
?????文件???????3046??2013-08-27?09:49??Account\bin\ATMMachinel2.class
?????文件???????1655??2013-08-27?09:49??Account\bin\Exercise19_20$1.class
?????文件???????1328??2013-08-27?09:49??Account\bin\Exercise19_20$2.class
?????文件???????1361??2013-08-27?09:49??Account\bin\Exercise19_20$BitOutputStream.class
............此處省略20個文件信息
- 上一篇:java語言實現當前月歷
- 下一篇:ALiSms所需要的jar包
評論
共有 條評論