题目内容

【说明】 IC卡和200卡都是从电话卡派生的。下面的程序将电话卡定义为抽象类。其中 balance为双精度变量,代表电话卡中的余额;cardNumber是长整型变量,代表电话卡的卡号;password是整型变量,代表电话卡的密码;connectNumber是字符串变量,代表电话卡的接入号码;connected是布尔变量,代表电话是否接通。 performDial()实现各种电话接通后的扣除费用的操作。其中200卡每次通话扣除0.5元的通话费用和附加费用;IC卡每次通话扣除0.9元的通话费。TimeLeft()方法用于测试电话卡余额还可以拨打电话的次数。performConnection()用于电话接入操作,如果卡号和密码正确,则接通;否则,接不通。 【程序】 abstract class PhoneCard doubte balace; (1) perfermDial(); double getBalance() return balance; double TimeLeft() double current=balance; int times=0; do (2) times++; white(balance>=0); balance=current; return times-1; abstract class Number_PhoneCard extends PhoneCard long cardNumber: int password; String connectNumber; Boolean connected; Boolean performConnection(long cn, int pw) if(cn==cardNumber && (3) ) connected=true; return true; else return false; class IC Card (4) boolean performDial() if(balance>0.9) balance-=0.9; return true; else return false; class D200_Card (4) static double additoryFee; static additoryFee=0.1; boolean performDial() if(balance>(0,5+additeryFee)) (5) return true; else return false;

查看答案
更多问题

These three teachers vary_________ their manner of teaching.

A. between
B. from
C. with
D. in

The girl is not happy at the new school. She has________ friends there.

A. few
B. a few
C. little
D. quite a few

It was while she was sleeping in her bedroom_________ a thief broke into the house.

A. which
B. that
C. where
D. than

The idea sounds very good but will it work in_________

A. practice
B. place
C. advance
D. company

答案查题题库