Professional Documents
Culture Documents
Name: Junaid Ahmed Class: Bsse Roll No: BSE-21S-099 Subject: Oops Section: Evening (2C) Course Insructor: Miss Saima Sipy
Name: Junaid Ahmed Class: Bsse Roll No: BSE-21S-099 Subject: Oops Section: Evening (2C) Course Insructor: Miss Saima Sipy
CLASS: BSSE
ROLL NO: BSE-21S-099
SUBJECT: OOPS
SECTION: EVENING (2C)
COURSE INSRUCTOR: MISS SAIMA
SIPY
Task 1:
Task 2:
import java.util.Scanner;
public class Rectangle {
int getLength() {
return this.length;
}
int getPerimeter() {
return (2 * getWidth()) + (2 * getLength());
}
int getArea() {
return (getWidth() * getLength());
}
boolean square() {
return (getWidth() == getLength());
}
if (rect.square()) {
System.out.println("\nThis is a square.");
} else {
System.out.println("\nRectangle is a square : False");
}
}
}