import CalTime.vehicle.all.Common;
import java .lang.*;
public class ComputeTime {
public static void main(String args[]) {
System.out.println(“交通工具: “+args[0]);
System.out.println(” 参数A: “+args[1]);
System.out.println(” 参数B: “+args[2]);
System.out.println(” 参数C: “+args[3]);
double A=Double.parseDouble(args[1]);
double B=Double.parseDouble(args[2]);
double C=Double.parseDouble(args[3]);
double v,t;
try {
Common d=(Common) Class.forName(“CalTime.vehicle.”+args[0]).newInstance();
v=d.runTimer(A,B,C);
t=1000/v;
System.out.println(“平均速度: “+v+” km/h”);
System.out.println(“运行时间:”+t+” 小时”);
} catch(Exception e) {
System.out.println(“class not found”);
}
}
}
package CalTime.vehicle;
import CalTime.vehicle.all.Common;
public class Plane implements Common {
public double runTimer(double a, double b, double c) {
return (a+ b + c);
}
}
package CalTime.vehicle;
import CalTime.vehicle.all.Common;
public class Car implements Common {
public double runTimer(double a, double b, double c) {
return ( a*b/c );
}
}
package CalTime.vehicle.all;
public interface Common {
double runTimer(double a, double b, double c);
}
interface Extendbroadable{
public void inPut();
}
class KeyBroad implements Extendbroadable{
public void inPut(){
System.out.println(“\n hi,keybroad has be input into then mainbroad!\n”);
}
}
class NetCardBroad implements Extendbroadable{
public void inPut(){
System.out.println(“\n hi,netCardBroad has be input into then mainbroad!\n”);
}
}
class CheckBroad{
public void getMainMessage(Extendbroadable ext){
ext.inPut();
}
}
public class InterfaceTest01{
public static void main(String []args){
KeyBroad kb=new KeyBroad();
NetCardBroad ncb=new NetCardBroad();
CheckBroad cb=new CheckBroad();
cb.getMainMessage(kb);
cb.getMainMessage(ncb);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有