package Shape;
public class Cirle extends Shape {
@Override
public void Perimeter() {
// TODO Auto-generated method stub
System.out.println("圆的周长是:"+(pi*r)*2);
}
@Override
public void area() {
// TODO Auto-generated method stub
System.out.println("圆的面积是:"+pi*r*r);
}
}
public class Cirle extends Shape {
@Override
public void Perimeter() {
// TODO Auto-generated method stub
System.out.println("圆的周长是:"+(pi*r)*2);
}
@Override
public void area() {
// TODO Auto-generated method stub
System.out.println("圆的面积是:"+pi*r*r);
}
}
2017-06-05
package Shape;
public class Rectangle extends Shape {
@Override
public void Perimeter() {
// TODO Auto-generated method stub
System.out.println("的周长是:"+(length+wide)*2);
}
public void area() {
// TODO Auto-generated method stub
System.out.println("长方形的面积:"+length*wide);
}
}
public class Rectangle extends Shape {
@Override
public void Perimeter() {
// TODO Auto-generated method stub
System.out.println("的周长是:"+(length+wide)*2);
}
public void area() {
// TODO Auto-generated method stub
System.out.println("长方形的面积:"+length*wide);
}
}
2017-06-05
package Shape;
public abstract class Shape {
double pi=3.14;
double length=2.0;
double wide=3.0;
double r=5.0;
public abstract void Perimeter();
public abstract void area();
}
public abstract class Shape {
double pi=3.14;
double length=2.0;
double wide=3.0;
double r=5.0;
public abstract void Perimeter();
public abstract void area();
}
2017-06-05
public class Txet {
public static void main(String[] args) {
Rectangle a=new Rectangle();
Cirle b=new Cirle();
System.out.println("矩形面积为="+a.S());
System.out.println("矩形周长为="+a.L());
System.out.println("圆形面积为="+b.S());
System.out.println("圆形周长为="+b.L());
}
}
//π改成3.14结果就对了
public static void main(String[] args) {
Rectangle a=new Rectangle();
Cirle b=new Cirle();
System.out.println("矩形面积为="+a.S());
System.out.println("矩形周长为="+a.L());
System.out.println("圆形面积为="+b.S());
System.out.println("圆形周长为="+b.L());
}
}
//π改成3.14结果就对了
2017-06-04
class Rectangle extends Shape{
public double S(){
return length*wide;
}
public double L(){
return (length+wide)*2;
}
}
class Cirle extends Shape{
public double S(){
return π*r*r;
}
public double L(){
return 2*π*r;
}
}
public double S(){
return length*wide;
}
public double L(){
return (length+wide)*2;
}
}
class Cirle extends Shape{
public double S(){
return π*r*r;
}
public double L(){
return 2*π*r;
}
}
2017-06-04
package text;
abstract class Shape{
public abstract double S();
public abstract double L();
double length=5.0;
double wide=5.0;
double r=5.0;
double π;
}
abstract class Shape{
public abstract double S();
public abstract double L();
double length=5.0;
double wide=5.0;
double r=5.0;
double π;
}
2017-06-04