Professional Documents
Culture Documents
Lab Assignment3
Lab Assignment3
Lab Assignment3
Reg no : FA21-BSE-047
Subject:OOP
Class : BSE-3B
Submitted to : Mam Samia riaz
Question:
write a program that fulfill Heretical inheritance.?
Answer:
import java.util.*; class
Shapes
{
protected String Color;
protected Boolean Fill;
public void Set_Color (String c)
{
this.Color = c;
}
System.out.println("======================================);
System.out.println(" Circle\n ");
System.out.println("The Area Of Circle is = " + this.Area);
System.out.println("The perimeter of Circle = " + this.Perimeter);
System.out.println("The Circumfarance of Circle = " + this.circumfarance);
System.out.println("The Color of your Circle is = " + this.Color);
System.out.println("Circle is Filled or not = " + this.Fill);
System.out.println("=====================================");
}
}
System.out.println("======================================");
System.out.println(" Square\n ");
System.out.println("The Area Of Square is = " + this.Area);
System.out.println("The perimeter of Square = " + this.Perimeter);
System.out.println("The Color of your Square is = " + this.Color);
System.out.println("Square is Filled or not = " + this.Fill);
System.out.println("======================================");
}
}
System.out.println("=====================================");
System.out.println(" Rectangle\n ");
System.out.println("The Area Of Rectangle is = " + this.R_Area);
System.out.println("The perimeter of Rectangle = " + this.Perimeter);
System.out.println("The Color of your Rectangle is = " + this.Color);
System.out.println("Rectangle is Filled or not = " + this.Fill);
System.out.println("======================================");
}
System.out.println("======================================");
System.out.println(" Triangle\n ");
System.out.println("The Area Of Triangle is = " + this.T_Area);
System.out.println("The perimeter of Triangle = " + this.T_Perimeter);
System.out.println("The Color of your Triangle is = " + this.Color);
System.out.println("Triangle is Filled or not = " + this.Fill);
System.out.println("=====================================");
}
} public class
Harerical_inheratince
{
public static void main(String args[])
{
circle c = new circle();
c.set_radius();
c.Set_Color("Red");
c.Set_Fil(Boolean.TRUE);
c.Set_Area();
c.Set_perimeter();
c.Set_circumfarance();
c.get_info_circle();
square s = new square();
s.set_length();
s.Set_Color("Green");
s.Set_Fil(Boolean.FALSE);
s.Set_Square_Area();
s.Set_Square_perimeter();
s.get_Square_info();