package ffff; public class Rectangle { int lenght; int width; public void area() { System.out.println(lenght*width); } public void zc(){ System.out.println(2*(lenght+width)); } public void showall(){ System.out.println("宽"+width ); System.out.println("长"+lenght); System.out.println("面积"); area(); System.out.println("周长"); zc(); } }
package ffff; import java.util.*; public class dedseff { public static void main(String[] args) { // TODO Auto-generated method stub Rectangle b=new Rectangle(); Scanner input=new Scanner(System.in); b.lenght=input.nextInt(); b.width=input.nextInt(); b.showall(); } }