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
12 changes: 12 additions & 0 deletions src/com/company/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.company;

public class Main {

public static void main(String[] args) {
Rectangle rect = new Rectangle(6,8);
rect.countArea();
rect.countPerimeter();
}
}


23 changes: 23 additions & 0 deletions src/com/company/Rectangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.company;

public class Rectangle {
public int length;
public int width;

public Rectangle() {
}


public Rectangle(int length, int width) {
this.length = length;
this.width = width;
}

public void countArea() {
System.out.println("Area is:"+length*width);
}
public void countPerimeter() {
System.out.println("Perimeter is:"+ 2*(length+width));
}
}