knrt.net
当前位置:首页 >> jAvA编写程序创建一个矩形类RECtAnglE >>

jAvA编写程序创建一个矩形类RECtAnglE

public class Rectangle{ private double width, height; public Rectangle() { this(0, 0); } public Rectangle(double width, double height) { this.width = width; this.height = height; } public double getCurve() { return 2.0f * (widt...

所有的程序都是从MAIN方法开始一步一步往下运行,你看程序下面都是输出了。 你这样看看 public static class TestRectangle{ public static void main (String args[]){ Rectangle r1=new Rectangle(5.6,12.5); Rectangle r2=new Rectangle(2,3)...

package com.jihe; public class Rectangle { private double width = 1.0; private double height = 1.0; Rectangle() {} Rectangle(double width, double height) { this.width = width; this.height = height; } public double getPerimeter(...

public class Rectangle{ private int width; private int height; public Rectangle(){ this.width = 10; this.height = 10; } public Rectangle(int width, int height){ this.width = width; this.height = height; } public int area(){ ret...

public class Rectangle { private double width; private double height; public Rectangle(double w,double h){ this.width = d; this.height = h; } publict double getArea(){ return width * height; } }

class Rectangle {private double width;private double height;public Rectangle(double width, double height) {this.width = width;this.height = height;}public double getC() {return (width + height) * 2;}public double getS() {return...

abstract class Shape{abstract double area();}class Circle extends Shape {private double r;private final double PI=3.14;public Circle(double r) {this.r = r;}@Overridedouble area() {return PI*r*r;}} class Rectangle extends Shape ...

这个应该很简单吧

需要用图形做么? 以下为代码 不知道可否... public class Rectangle { /** * @param args */ private double width=1; private double height=1; private String color="white"; public Rectangle() { } public String getColor() { return col...

//Shape.java public interface Shape{ public double calarea(); } //Rectangle.java public class Rectangle implements Shape{ private double length; private double high; public Rectangle(double length,double high){ this.length = le...

网站首页 | 网站地图
All rights reserved Powered by www.knrt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com