Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Rectangle/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Main {
public static void main(String[] args) {
Rectangle rectangle =new Rectangle();
Rectangle rectangle2=new Rectangle();
rectangle2.width = 8;
rectangle2.length = 6;
rectangle.info();
rectangle2.info();
}

}
17 changes: 17 additions & 0 deletions Rectangle/src/Rectangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class Rectangle {
public double width;
public double length;

public Rectangle() {

this.length=10;
this.width=5;
System.out.println("Rectangle створено");
}
public void info(){
System.out.println("прямокутник: ширина = "+width+", довжина = "+length);
System.out.println("Площа прямокутника: "+width*length);
System.out.println("Периметр прямокутника: "+(width+length)*2);
}

}