// 给三元组的各分量同乘一个比例因子
public void mulCoef(int coef) {
System.out.println("请输入一个比例因子:");
Scanner sc = new Scanner(System.in);
coef=sc.nextInt();
e1=e1* coef;e2=e2* coef;e3=e3* coef;
}
public class TestTriplet {
public static void main(String[] args) {
// 此处声明并创建Triplet类的实例化对象triplet
Triplet triplet = new Triplet();
int num;
Scanner sc = new Scanner(System.in);
num = sc.nextInt();
switch(num) {
case 1: {triplet.mulCoef( );break;}
}
}
}
}
运行结果及报错内容
谢谢解答!!