import java.util.Scanner;
//—————小汽车类
class Engine{}
class Door{}
class Windows{}
class car{
String pinpai;
float price;
Engine eg1;
Door d[];
Windows w[];
void stop(){}
void start(){}
}
//——————长方形类
class Rectangle {
float len;
float width;
public float area(float len,float width){
return len*width;
}
public float circle(float len,float w){
return 2*(len+width);
}
}
public class Test{ // 主类,引用并测试与矩形之间的关系
Rectangle r1=new Rectangle();
public static void main(String args[]){
Test t1=new Test();
Scanner sc=new Scanner(System.in);
float len=0;
float width=0;
float s=0;
System.out.println("输入R1矩形的长是:");
len=sc.nextInt();
System.out.println("输入R1矩形的宽是:");
width=sc.nextInt();
s=t1.r1.area(len, width);
System.out.println("R1矩形的面积是:"+s);
}
}
页面更新:2024-04-06
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号