
import javaio;
abstract class PhoneCard
{
int balance = 3000;
int getbalance()
{
return balance;
}
abstract void Call() throws IOException;
}
abstract class None_Number_PhoneCard extends PhoneCard
{
String type = "无号码电话卡";
String gettype()
{
return type;
}
}
class magCard extends None_Number_PhoneCard
{
String area;
void Call() throws IOException
{
BufferedReader buf = new BufferedReader(new InputStreamReader(Systemin));
String s;
long start, end;
int cost;
while (true)
{
if (60 <= thisgetbalance())
{
Systemoutprint("请输入你要呼叫的号码(挂机请直接按回车键):");
s = bufreadLine();
if (sequals(""))
{
break;
}
Systemoutprint("接通中,请稍后");
for (int i = 0; i <= 6; i++)
{
for (int j = 1; j <= 100000000; j++)
{
if (j % 10000000 == 0)
Systemoutprint('');
}
for (int j = 1; j <= 10; j++)
{
Systemoutprint('\b');
}
Systemoutprint(" ");
for (int j = 1; j <= 10; j++)
{
Systemoutprint('\b');
}
}
for (int i = 1; i <= 14; i++)
{
Systemoutprint('\b');
}
Systemoutprint("电话接通,开始计时(按回车键结束本次通话):");
start = SystemcurrentTimeMillis();
s = bufreadLine();
end = SystemcurrentTimeMillis();
Systemoutprintln("本次通话时间:" + (end - start) / 60000 + "分" + (((end - start) / 1000) % 60) + "秒");
cost = (int)((end - start + 59999) / 60000) 60;
Systemoutprintln("本次通话费用:" + cost / 100 + "" + cost % 100);
thisbalance -= cost;
Systemoutprintln("当前卡内余额:" + thisbalance / 100 + "" + thisbalance % 100);
Systemoutprintln("\n");
}
else
{
Systemoutprintln("当前余额不足,请换卡……");
break;
}
}
}
}
public class test8
{
public static void main(String[] args)
{
magCard a = new magCard();
Systemoutprintln("");
Systemoutprintln("你正使用的是" + atype);
Systemoutprintln("本卡仅限于区号" + aarea + "范围内使用");
Systemoutprintln("当前卡内余额:" + agetbalance() / 100 + "" + agetbalance() % 100);
Systemoutprintln("");
try
{
aCall();
}
catch (IOException e)
{
eprintStackTrace();
}
}
}
以上就是关于求:编写一个java应用程序全部的内容,包括:求:编写一个java应用程序、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)