This commit is contained in:
RafayAhmad7548 2024-06-16 18:53:25 +05:00
parent 37776af5db
commit ab03d5f10c
4045 changed files with 286212 additions and 3 deletions

View file

@ -0,0 +1,64 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(10, 10, 10);
shapes[1] = new Rectangle(30, 50);
shapes[0]->calcArea();
shapes[1]->calcArea();
cout<<"Circle: "<<shapes[0]->getArea()<<endl;
return 0;
}

View file

@ -0,0 +1,19 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
};
int main(){
return 0;
}

View file

@ -0,0 +1,66 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(0, 0, 10);
shapes[1] = new Rectangle(30, 50);
cout<<"Circle: "<<shapes[0]->getArea()<<endl;
cout<<"Rectangle: "<<shapes[1]->getArea()<<endl;
delete shapes[0];
delete shapes[1];
delete[] shapes;
return 0;
}

View file

@ -0,0 +1,32 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,21 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,13 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
int main(){
return 0;
}

View file

@ -0,0 +1,56 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes;
return 0;
}

View file

@ -0,0 +1,56 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,22 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
int main(){
return 0;
}

View file

@ -0,0 +1,26 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
class Circle : public BasicShape{
};
int main(){
return 0;
}

View file

@ -0,0 +1,61 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(10, 10, 10);
shapes[1] = new Rectangle(30, 50);
return 0;
}

View file

@ -0,0 +1,28 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
};
int main(){
return 0;
}

View file

@ -0,0 +1,38 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,45 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
};
int main(){
return 0;
}

View file

@ -0,0 +1,66 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY), radius(radius){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(0, 0, 10);
shapes[1] = new Rectangle(30, 50);
cout<<"Circle: "<<shapes[0]->getArea()<<endl;
cout<<"Rectangle: "<<shapes[1]->getArea()<<endl;
delete shapes[0];
delete shapes[1];
delete[] shapes;
return 0;
}

View file

@ -0,0 +1,42 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
};
int main(){
return 0;
}

View file

@ -0,0 +1,17 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
};
int main(){
return 0;
}

View file

@ -0,0 +1,64 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(10, 10, 10);
shapes[1] = new Rectangle(30, 50);
shapes[0]->calcArea();
shapes[1]->calcArea();
return 0;
}

View file

@ -0,0 +1,50 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
void calcArea() override{
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,30 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
};
int main(){
return 0;
}

View file

@ -0,0 +1,43 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
};
int main(){
return 0;
}

View file

@ -0,0 +1,62 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(0, 0, 10);
shapes[1] = new Rectangle(30, 50);
cout<<"Circle: "<<shapes[0]->getArea()<<endl;
cout<<"Rectangle: "<<shapes[1]->getArea()<<endl;
return 0;
}

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/OOP/lab15/lab15.cpp","entries":[{"id":"CGB4.cpp","timestamp":1714968342279},{"id":"RSST.cpp","timestamp":1714968383646},{"id":"2D4M.cpp","timestamp":1714968427129},{"id":"B4Fg.cpp","timestamp":1714968496582},{"id":"Du76.cpp","timestamp":1714968513955},{"id":"qMEu.cpp","timestamp":1714968532072},{"id":"GerB.cpp","timestamp":1714968832822},{"id":"IBRX.cpp","timestamp":1714968897645},{"id":"XJP7.cpp","timestamp":1714968932949},{"id":"7E4T.cpp","timestamp":1714968985145},{"id":"hDuY.cpp","timestamp":1714969010551},{"id":"lmTf.cpp","timestamp":1714969023684},{"id":"m2um.cpp","timestamp":1714969038427},{"id":"JH2O.cpp","timestamp":1714969078217},{"id":"R7mB.cpp","timestamp":1714969109920},{"id":"amR0.cpp","timestamp":1714969163993},{"id":"KMHn.cpp","timestamp":1714969174083},{"id":"w1Cq.cpp","timestamp":1714969206006},{"id":"UbLy.cpp","timestamp":1714969227832},{"id":"v5TW.cpp","timestamp":1714969266492},{"id":"D8Wj.cpp","timestamp":1714969277682},{"id":"CwBh.cpp","timestamp":1714969313838},{"id":"gc5B.cpp","timestamp":1714969342955},{"id":"GsiF.cpp","timestamp":1714969391538},{"id":"SS3q.cpp","timestamp":1714969422895},{"id":"0pbt.cpp","timestamp":1714969483534},{"id":"nd5x.cpp","timestamp":1714969524731},{"id":"y8Hu.cpp","timestamp":1714969580587},{"id":"d5Dk.cpp","timestamp":1714969703617},{"id":"2ElL.cpp","timestamp":1714971155366},{"id":"Ltcg.cpp","timestamp":1714971355086}]}

View file

@ -0,0 +1,56 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
return 0;
}

View file

@ -0,0 +1,35 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,35 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,38 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,65 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(10, 10, 10);
shapes[1] = new Rectangle(30, 50);
shapes[0]->calcArea();
shapes[1]->calcArea();
cout<<"Circle: "<<shapes[0]->getArea()<<endl;
cout<<"Rectangle: "<<shapes[1]->getArea()<<endl;
return 0;
}

View file

@ -0,0 +1,26 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
};
class Circle : public BasicShape{
};
int main(){
return 0;
}

View file

@ -0,0 +1,56 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,47 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
};
int main(){
return 0;
}

View file

@ -0,0 +1,62 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class BasicShape{
double area;
public:
double getArea(){
return area;
}
virtual void calcArea() = 0;
void setArea(double area){
this->area = area;
}
};
class Circle : public BasicShape{
long int centerX;
long int centerY;
double radius;
public:
Circle(long int centerX, long int centerY, double radius) : centerX(centerX), centerY(centerY){
calcArea();
}
void calcArea() override{
setArea(3.14159*radius*radius);
}
};
class Rectangle : public BasicShape{
long int width;
long int length;
public:
Rectangle(long int width, long int length) : width(width), length(length){
calcArea();
}
long int getWidth(){
return width;
}
long int getLength(){
return length;
}
void calcArea() override{
setArea(width*length);
}
};
int main(){
BasicShape **shapes = new BasicShape*[2];
shapes[0] = new Circle(10, 10, 10);
shapes[1] = new Rectangle(30, 50);
cout<<"Circle: "<<shapes[0]->getArea()<<endl;
cout<<"Rectangle: "<<shapes[1]->getArea()<<endl;
return 0;
}