public class Test extends PhoneKouFei{
public Test(String startTime, String stopTime) {
super(startTime, stopTime);
}
public static void main(String[] args) {
String start = "00:12:23";
String stop = "00:15:23";
new Test(start,stop);
}
}
abstract class PhoneKouFei{
private final double fei = 15;//1分钟扣1毛5
public String startTime; //通话开始时间
public String stopTime; //通话结束时间
public PhoneKouFei(String startTime, String stopTime){
thisstartTime = startTime;
thisstopTime = stopTime;
Systemoutprintln("通话时常:" +getKouFei()+ "分钟");
Systemoutprintln("应扣费:" + (double)getKouFei() fei);
}
//扣费方法
private final long getKouFei(){
javatextSimpleDateFormat sim = new javatextSimpleDateFormat("HH:mm:ss");
try {
javautilDate start = simparse(thisstartTime);
javautilDate stop = simparse(thisstopTime);
return (stopgetTime() - startgetTime()) / 60000;
} catch (javatextParseException e) {
throw new RuntimeException("时间格式错误");
}
}
}
//输出结果:
通话时常:3分钟
应扣费:45
下面是代码实现,请采纳
package comnzhihu;
public class MainTest {
public static void main(String[] args) {
Phone p = new Phone();
pcall(null);
}
//联系人
class Contact{
public String name;
public String phone;
public String address;
public String getName() {
return name;
}
public void setName(String name) {
thisname = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
thisphone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
thisaddress = address;
}
public Contact(String name, String phone, String address) {
super();
thisname = name;
thisphone = phone;
thisaddress = address;
}
}
class Phone{
//call(name)方法,可以用于打电话给某人,如果没有输出一句话,通讯录中没有此人;
//可以调用addPhoneNumber(Contact con)方法,向手机添加联系人;可以播放名字为某某的歌曲。
public String brand;
public String type;
public String memory;
public String price;
public AddrBook addrBook;
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
thisbrand = brand;
}
public String getType() {
return type;
}
public void setType(String type) {
thistype = type;
}
public String getMemory() {
return memory;
}
public void setMemory(String memory) {
thismemory = memory;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
thisprice = price;
}
public Phone phoneInfo(){
Phone p = new Phone();
psetBrand(thisbrand);
psetType(thistype);
psetMemory(thismemory);
psetPrice(thisprice);
return p;
}
public void call(String name){
if(name == null || name == ""){
Systemoutprintln("没有此人");
}
}
}
//通讯录
interface AddrBook{
public void addContact(Contact con);
}
}
Java软件,据了解,目前还没有这样的功能;不过A127是支持IP拨号的咧,你进入设置-通讯设置-IP拨号中打开12593的前缀,每次打电话的时候先输入号码(或者从通讯录中选择),按左键 选项 ,选择IP拨号即可
以上就是关于利用java编写一个电话扣费的程序全部的内容,包括:利用java编写一个电话扣费的程序、java实验类程序、JAVA软件有没有打电话自动加播12953的软件,手机为OPPO A127等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)