问题 填空题

请完善程序(程序文件名:Java_3.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。
题目要求:
编写程序完成类Java_3的完整功能,该类定义了几何点对象的操作。
该程序的运行结果如下:
x=5 y=5
Location is(5,5)
x=8 y=9
Location is(8,9)
源程序:
 public class Java_3
  int x,y; //点的坐标
  public Java_3()
  public Java_3(int x,int y) (1) //构造方法,对(x,y)进行初始赋值
  public Java_3(Java_3 P) (2) //构造方法,将P的坐标赋值给(x,y)
  //以对象的形式返回当前点的位置
  public Java_3 getLocation()
   Java_3 p= (3) ; //实例化一个Java_3对象p,其坐标是(x,y)
    (4) ; //返回对象p
  
  public int getX() return x; //返回点的横坐标
  public int getY() return y; //返回点的纵坐标
  public void move(int x,int y) this.x=x;this.y=y; //把当前点移到新的位置(x,y)上
  public String toString() return"("+x+","+y+")"; //以(x,y)的格式返回点的位置
  public void translate(int x,int y)this.x+=x;this.y+=y; //在原有坐标上分别增加x和y
  public static void main(String args[])
   Java_3 P= (5) ; //生成一个对象(5,5)
   System.out.println("x="+p.x+"y="+p.y);
   System.out.println("Location is"+p.toString()); //12(x,y)的方式打印坐标的位置
    (6) ; //在原有位置上增加(3,4)
   System.out.println("x="+p.x+"y="+p.y); //打印横坐标和纵坐标的值
   System.out.println("Location is"+p.toString()); //以(x,y)的方式打印坐标的位置
  

答案

参考答案:p.translate(C,D)

解析: 注释中说明在原有位置增加(3,4),因此需要对对象调用方法translate()。可以通过方法的定义看出是在原有位置增加一定值。
[程序解析] 本程序主要考查类的对象的创建、构造方法的重载和类的方法使用。

改错题
短文改错。
此题要求改正所给短文中的错误。对标有题号的每一行作出判断:如无错误,在该行右边横线上画
一个勾(√);如有错误(每行只有一个错误),则按下列情况改正:
此行多一个词:把多余的词用斜线划掉,在该行右边横线上写出该词,并也用斜线划掉。
此行缺一个词:在缺词处加一个漏字符号(∧),在该行右边横线上写出该加的词。
此行错一个词:在错的词下画一横线,在该行右边横线上写出改正后的词。
注意:原行没有错的不要改。
A few months after returning the US from Germany, I took       
part in a college course in French. Since I have learned to    
speak German good in Germany, I thought that it might be     
interested to begin studying another language. At the first    
class, the teacher asked us to do a pronunciation exercise,     
in which he would say one word or two in French, and each        
student would do their best to copy. When he got to her, he     
kept having me to say more words, and I finally asked him       
why. "I find it great funs. Its the first time I  have heard an   
American speak French with a German accent." he explained it.  
1.___________          
2.___________       
3.___________         
4.___________       
5.___________                                   
6.____________         
7.____________         
8.____________          
9.____________      
10.____________     
单项选择题