可透支銀行賬戶 繼承與super的使用

2021-10-08 18:28:30 字數 1800 閱讀 6567

@override

public

void

withdraw

(double amount)

else

else}}

else

}

完整**:

package com.jicheng.test4;

//賬戶類

public

class

account

//有參構造器

public

account

(int id,

double balance,

double annualinterestrate)

//返回月利率的方法

public

double

getmonthlyinterest()

//取款方法

public

void

withdraw

(double amount)

else

}//存款方法

public

void

deposit

(double amount)

else

}//獲取id

public

intgetid()

//修改id

public

void

setid

(int id)

//獲取餘額

public

double

getbalance()

//修改餘額

public

void

setbalance

(double balance)

//獲取年利率

public

double

getannualinterestrate()

//修改年利率

public

void

setannualinterestrate

(double annualinterestrate)

}

package com.jicheng.test4;

//可透支的賬戶

public

class

checkaccount

extends

account

//重寫有參構造器方法,加入可透支額度

public

checkaccount

(int id,

double balance,

double annualinterestrate,

double overdraft)

//重寫取款方法

@override

public

void

withdraw

(double amount)

else

else}}

else

}//獲取可透支金額

public

double

getoverdraft()

//修改可透支金額

public

void

setoverdraft

(double overdraft)

}

package com.jicheng.test4;

public

class

accounttest

}

銀行賬戶管理系統

package bankmanagementsystem public user package bankmanagementsystem public admin package bankmanagementsystem public class ui public static void sho...

Oracle EBS 銀行賬戶API

建立銀行 create bank declare p init msg list varchar2 200 p country code varchar2 200 p bank name varchar2 200 p bank number varchar2 200 p alternate bank...

異常 銀行賬戶異常處理

自定義乙個accountexception異常類 建立乙個bankdemo類,該類包括 私有成員變數 double account 從個人賬戶 公有成員方法 setaccount double account 往賬戶存錢 double getaccount 獲取賬戶餘額 show int x 建立乙...