91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-22
  • 語言: Java
  • 標簽:

資源簡介

基于構造函數,繼承和多態的實現,包含梯形,平行四邊形,矩形,正方形

資源截圖

代碼片段和文件信息

package?duotai1;
package?duotai1;

public?class?Parallelogram?extends?Quadrilateral
{
private?float?Width;
private?float?Height;
private?float?Area;
public?Parallelogram(float?x1?float?y1?float?x2?float?y2?float?x3
float?y3?float?x4?float?y4)?
{
super(x1?y1?x2?y2?x3?y3?x4?y4);
System.out.print(“\nCoordinate?of?Parallelogram?are:\n“);
System.out.print(“(“+x1+““+y1+“)(“+x2+““+y2+“)(“+x3+““+y3+“)(“+x4+““+y4+“)\n“);
Width=x2-x1;
Height=y4-y1;
Area=Height*Width;

}
public?void?show()
{
System.out.print(“Width?is:?“+Width+“\nHeight?is:?“+Height+“\nArea?is:?“+Area+“\n“);
}
}

package?duotai1;

public?class?Quadrilateral?
{
private?float?x1y1;
private?float?x2y2;
private?float?x3y3;
private?float?x4y4;
public?Quadrilateral(float?x1float?y1float?x2float?y2
float?x3float?y3float?x4float?y4)
{
this.x1=x1;this.y1=y1;
this.x2=x2;this.y2=y2;
this.x3=x3;this.y3=y3;
this.x4=x4;this.y4=y4;
}
public?void?show()
{
System.out.print(“Coordinate?of?Quadrilateral?are:\n“);
System.out.print(“(“+x1+““+y1+“)(“+x2+““+y2+“)(“+x3+““+y3+“)(“+x4+““+y4+“)\n“);
}
}

package?duotai1;

public?class?Rectangle?extends?Quadrilateral
{
private?float?Width;
private?float?Height;
private?float?Area;
public?Rectangle(float?x1?float?y1?float?x2?float?y2?float?x3
float?y3?float?x4?float?y4)?
{
super(x1?y1?x2?y2?x3?y3?x4?y4);
System.out.print(“\nCoordinate?of?Rectangle?are:\n“);
System.out.print(“(“+x1+““+y1+“)(“+x2+““+y2+“)(“+x3+““+y3+“)(“+x4+““+y4+“)\n“);
Width=x2-x1;
Height=y4-y1;
Area=Height*Width;

}
public?void?show()
{
System.out.print(“Width?is:?“+Width+“\nHeight?is:?“+Height+“\nArea?is:?“+Area+“\n“);
}
}


評論

共有 條評論

相關資源