6-6 TDVector (10分)
6-6 TDVector (10分)
There is a class TDVector that is incompleted. Please complete the class according to the test code in Main.
函数接口定义:
class TDVector {
private double x;
private double y;
public String toString() {
return “(”+this.x+","+this.y+")";
}
}
裁判测试程序样例:
import java.util.Scanner;
class TDVector {
private double x;
private double y;
public String toString() {
return “(”+this.x+","+this.y+")";
}
/** 你所提交的代码将被嵌在这里(替换此行) **/
}
public class Main {
public static void main(String[] args) {
TDVector a = new TDVector(); // default ctor, x and y are zeros
Scanner sc = new Scanner(System.in);
double