Java Bangla Tutorials 131 : Problem solving-2 (Abstract class Shape)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Awesome! Good video for problem solving and practicing. Thanks!

jyotirmoygoswami
Автор

why does his lectures seem way more easier than my college class lectures? damn, and it's free

tawsifmasrurhaque
Автор

vaiya ei problem gulate setter and gatter use korle best hoyto..
thanks for you video vaiya ..and thanks for help us ..

ontorsorker
Автор

thank you for these wonderful videos.

shihanalam
Автор

thanks sir
compettive programing er jonno
algorithm er upor kisu bangla vedio banale khubie bhalo hoto
Like BFS, DP
cz different web site theke dekhe shika onek kosto kor onek somoy bujau jay na
ar aysob upor bangla tuitorial to pauay jay so
sir aysob er upor vedio banale khubie bhalo hoto

kazimdanisurrahman
Автор

package Abtraction;


public abstract class Shape {
double dim1, dim2;

Shape(double dim1, double dim2){
this.dim1 = dim1 ;
this.dim2 = dim2 ;
}

abstract void area();

}

package Abtraction;

public class Rectangle extends Shape{

Rectangle(double dim1, double dim2){
super( dim1, dim2);
}
void area(){
double result = dim1 * dim2 ;
System.out.println("The Area of Rectangle is : "+result);
}

}

package Abtraction;


public class Triangle extends Shape {
Triangle(double dim1, double dim2){
super ( dim1, dim2);
}
void area(){
double result = 0.5* dim1 * dim2 ;
System.out.println("The Area of Triangle is : "+result);
}
}

package Abtraction;

public class Circle extends Shape{

Circle(double r){
super(r, r);
}

void area(){
double result = Math.PI * dim1 *dim2;
System.out.println("The Area of Circle is : "+result);
}
}

package Abtraction;


public class Test1 {
public static void main(String[] args) {

Shape s;
s = new Rectangle(10, 20);
s.area();
s = new Triangle(10, 20);
s.area();
s = new Circle(10);
s.area();
}
}

tomabanik
Автор

sir rectangle circle traingle class e
abstract method ke override kora hoi ni keno???

kazimdanisurrahman
Автор

I have done the same code but it's giving me 0 value. Why?

nahidasultana
Автор

Assalamualikum
I'm watching your videos to learn java programming. I'm from Bangladesh.

Is there any way that I could take any random input. And depending on the input, the function will decide on which data it has to select.
If a user type (1) it'll automatically choose integer as data type or if the user type a name, the data type would be a String

hi
Автор

Vhaiya, Ai problem ta onekbar try korchi. Line by line check korchi But each time sob gular area amake 0.0 show korteche
Kono error nai but amn hocche keno bujhlam na
If you kindly help, then it would be great.

Thanks a lot :)

sharifulsujon
Автор

package advancejava.AbstractionExam;
public abstract class Shape {
double d1, d2;
Shape(double d1, double d2)
{
this.d1=d1;
this.d2=d2;
}
abstract void area();
}

package advancejava.AbstractionExam;
public class Triangle extends Shape {
Triangle(double d1, double d2) {
super(d1, d2);
}
@Override
void area()
{
double area1, b, h;
area1=0.5*d1*d2;
System.out.println("Area of Triangle="+area1);
}
}

package advancejava.AbstractionExam;
public class Rectangle extends Shape {
Rectangle(double d1, double d2) {
super(d1, d2);
}
@Override
void area() {
double area2=d1*d2;
System.out.println("Area of Rectangle="+area2);
}
}

package advancejava.AbstractionExam;
public class Circle extends Shape {
Circle(double r) {
super(r, r);
}
@Override
void area() {
double area3=Math.PI*d1*d2;
System.out.printf("Area of Circle=%.2f", area3);
System.out.println();
}
}

package advancejava.AbstractionExam;
public class Test {
public static void main(String[] args) {
Shape Area;
Area=new Triangle(10, 15);
Area.area();
Area=new Rectangle(11, 11);
Area.area();
Area=new Circle(4);
Area.area();
}
}

mdshamsulalammomin
visit shbcf.ru