Initial commit
This commit is contained in:
22
实验报告模板/实验报告6/p14/Test.java
Normal file
22
实验报告模板/实验报告6/p14/Test.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.p14;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
//开卡
|
||||
BusCard card=new BusCard();
|
||||
//充值
|
||||
card.charge(2);
|
||||
//查询余额
|
||||
System.out.println("余额:"+card.queryBalance());
|
||||
|
||||
//刷卡
|
||||
try {
|
||||
card.swipe(5);
|
||||
System.out.println("刷卡成功!您的余额:"+card.queryBalance());
|
||||
} catch (CardException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user