python计算长⽅形的周长和⾯积_计算矩形的周长和⾯积我需要能够将矩形的长度和宽度输⼊到控制台并计算其周长和⾯积。除了接受我的输⼊以进⾏计算外,我还有其他⼯作。我知道我很接近,但似乎⽆法弄清楚。在此先感谢您的帮助。请记住,我是⼀个很好的新⼿,所以你的答案⼀开始可能对我没有意义。我⽆法得到它来计算我输⼊到控制台的值。
package it325_lab1;
public class Rectangle {
private static double length;
private static double width;
public Rectangle() {
length=0.0;
width=0.0;
}
public Rectangle(double l, double w) {
length = l;stop的用法
width = w;
}
logmeinpublic double FindArea() {
return length*width;
viking}
public double FindPerim() {
return length*2 + width*2;
}
}
package it325_lab1;
import java.util.Scanner;
public class TestRectangle {
/**
flat是什么意思
* @param args
*/杭州计算机学校
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanL = new Scanner (System.in);
System.out.print("Plea enter the length of the rectangle: ");
double L = Double();
Scanner scanW = new Scanner (System.in);
System.out.print("Plea enter the length of the rectangle: ");星期一>中级口译培训
double W = Double();
//int W = Int();
double RectangleArea;
Rectangle unitRectangle = new Rectangle();
RectangleArea = unitRectangle.FindArea();
System.out.println("The area of a unit rectangle is " + RectangleArea);
double RectanglePermiter;avatar什么意思
palmRectangle perimRectangle = new Rectangle();
RectanglePermiter = perimRectangle.FindPerim();atp是什么
System.out.println("The permimiter of the unit rectangle is " + RectanglePermiter); }
}