高分求Java编程题目三题,1.已知Point 类定义(声明)如下:public class Point {private int x;private int y;public Point(){}public Point( int xValue,int yValue ){x = xValue;y = yValue;}public void setX( int xValue ){x = xValue;}public i
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 14:10:17
高分求Java编程题目三题,1.已知Point 类定义(声明)如下:public class Point {private int x;private int y;public Point(){}public Point( int xValue,int yValue ){x = xValue;y = yValue;}public void setX( int xValue ){x = xValue;}public i
高分求Java编程题目三题,
1.
已知Point 类定义(声明)如下:
public class Point {
private int x;
private int y;
public Point()
{
}
public Point( int xValue,int yValue )
{
x = xValue;
y = yValue;
}
public void setX( int xValue )
{
x = xValue;
}
public int getX()
{
return x;
}
public void setY( int yValue )
{
y = yValue;
}
public int getY()
{
return y;
}
public String toString()
{
return "[" + x + "," + y + "]";
}
}
不使用继承,设计一个圆类(Circle),要求:该类具有三个私有int 成员:圆心坐标x 和y,
半径radius,相应的Sets 和Gets 方法,计算圆周长(zhouChang)和面积(mianJi)的方法及toString
方法.
2.编写程序,求5 + 10 + 15 + .+ 100,并输出其结果
3.下面的程序完成求两个数的最大值并输出,填写适当的语句.
public class triMax {
public static void main( String[] args ) {
int max,a,b;
a = 10; b = 18;
_________;
if ( max < b )__________ ;
System.out.println( “Max=” + max );
}
}
高分求Java编程题目三题,1.已知Point 类定义(声明)如下:public class Point {private int x;private int y;public Point(){}public Point( int xValue,int yValue ){x = xValue;y = yValue;}public void setX( int xValue ){x = xValue;}public i
1.
public class Circle {
public static Double PI = 3.14;
private int x;
private int y;
private int radius;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getRadius() {
return radius;
}
public void setRadius(int radius) {
this.radius = radius;
}
public double zhouchang(){
return 2*Circle.PI*radius;
}
public double mianji(){
return Circle.PI*radius*radius;
}
public String toString(){
return "[ zhouchang = "+ zhouchang()+" ; mianji = "+ mianji()+"]";
}
}
2.
public class Calculate {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i = 5;
int sum = 0;
while(i