مشاهدة "برمجة كيانية _جافا شرح انشاء كلاس واستدعائه بكلاس ثاني" على YouTube
https://youtu.be/qH52nZYcxhU
https://youtu.be/qH52nZYcxhU
YouTube
برمجة كيانية _جافا شرح انشاء كلاس واستدعائه بكلاس ثاني
OOP
JAVA PROGRAMMING
Ali Aqeel
كتبولي ملاحظاتكم بالتعليقات❤️❤️
JAVA PROGRAMMING
Ali Aqeel
كتبولي ملاحظاتكم بالتعليقات❤️❤️
مستند جديد 68.pdf
18.5 MB
بفضل الله وبعض من الطلاب (علي عقيل و دعاء سمير)على مساعده ببعض من المعلومات على مادة جافا سويت pdf وان شاء تستفادون منه واذه بيه اخطأ صحح الخطأ انت/انتي 🌸
التوفيق للجميع
التوفيق للجميع
package inhariretins;
public class Rectangiel {
private double length;
private double width;
public Rectangiel()
{
length=1;
width=1;
}
Rectangiel(double l, double w)
{
setdimetion(l,w);
}
public void setdimetion(double l, double w)
{
if(l>0)
length=l;
else
length=1;
if(w>0)
width=w;
else
width=1;
}
public double getlenth()
{
return length;
}
public double getwidth()
{
return width;
}
public double Area()
{
return length*width;
}
public double Perimeter()
{
return (length+width)*2;
}
public void print()
{
System.out.println(" Length : "+length+" \n widgth : "+width+" "
+ " \n area : "+Area()+" \n perimeter : "+Perimeter());
}
}
public class Rectangiel {
private double length;
private double width;
public Rectangiel()
{
length=1;
width=1;
}
Rectangiel(double l, double w)
{
setdimetion(l,w);
}
public void setdimetion(double l, double w)
{
if(l>0)
length=l;
else
length=1;
if(w>0)
width=w;
else
width=1;
}
public double getlenth()
{
return length;
}
public double getwidth()
{
return width;
}
public double Area()
{
return length*width;
}
public double Perimeter()
{
return (length+width)*2;
}
public void print()
{
System.out.println(" Length : "+length+" \n widgth : "+width+" "
+ " \n area : "+Area()+" \n perimeter : "+Perimeter());
}
}
package inhariretins;
public class Box extends Rectangiel {
private double higth;
public Box()
{
super();
higth=1;
}
public Box(double l ,double w, double h)
{
super(l,w);
if(h>0)
higth=h;
else
higth=1;
}
public double Area()
{
return Perimeter()*higth;
}
public double volum()
{
return super.Area()*higth;
}
public void print()
{
super.print();
System.out.println(" Area "+Area()+" valom "+volum());
}
}
public class Box extends Rectangiel {
private double higth;
public Box()
{
super();
higth=1;
}
public Box(double l ,double w, double h)
{
super(l,w);
if(h>0)
higth=h;
else
higth=1;
}
public double Area()
{
return Perimeter()*higth;
}
public double volum()
{
return super.Area()*higth;
}
public void print()
{
super.print();
System.out.println(" Area "+Area()+" valom "+volum());
}
}
package inhariretins;
public class Inhariretins {
public static void main(String[] args) {
Rectangiel rec1=new Rectangiel ();
Rectangiel rec2=new Rectangiel (8,6);
Box mybox1=new Box();
Box mybox2=new Box(10,7,3);
System.out.println("rec1 ");
System.out.println();
rec1.print();
System.out.println();
System.out.println(" Area rec 1 "+ rec1.Area());
System.out.println();
System.out.println(" rec2 ");
System.out.println();
System.out.println(" Area of rec2 "+rec2.Area());
System.out.println( "box1 ");
System.out.println();
mybox1.print();
System.out.println(" super area box2 "+mybox1.Area());
System.out.println(" volum my box1 "+mybox1.volum());
System.out.println("mybox 2 ");
System.out.println();
mybox2.print();
System.out.println(" super of mybox 2 "+mybox2.Area());
System.out.println(" super of mybox 2 "+mybox2.volum());
}
}
public class Inhariretins {
public static void main(String[] args) {
Rectangiel rec1=new Rectangiel ();
Rectangiel rec2=new Rectangiel (8,6);
Box mybox1=new Box();
Box mybox2=new Box(10,7,3);
System.out.println("rec1 ");
System.out.println();
rec1.print();
System.out.println();
System.out.println(" Area rec 1 "+ rec1.Area());
System.out.println();
System.out.println(" rec2 ");
System.out.println();
System.out.println(" Area of rec2 "+rec2.Area());
System.out.println( "box1 ");
System.out.println();
mybox1.print();
System.out.println(" super area box2 "+mybox1.Area());
System.out.println(" volum my box1 "+mybox1.volum());
System.out.println("mybox 2 ");
System.out.println();
mybox2.print();
System.out.println(" super of mybox 2 "+mybox2.Area());
System.out.println(" super of mybox 2 "+mybox2.volum());
}
}