You are on page 1of 7

// only Abdul Hadi E services channel brings free solution for you

# include <iostream>

using namespace std;

# define PI 3.14159265

class Circle

private:

double radius;

public:

void setRadius();

void computeAreaCirc();

Circle();

~Circle();

};

Circle::Circle()

radius = 0.0;

void Circle::setRadius()

radius = 5.6;

void Circle::computeAreaCirc()

cout << "Area of circle is: " << PI * (radius * radius) << endl;

cout << "Circumference of circle is: " << 2 * PI * radius << endl;

Circle::~Circle()

{
}

class Rectangle

Private:

Double length;

Double width;

Public:

Void setLength();

Void setWidth();

Void computeArea();

Rectangle();

~Rectangle();

};

Rectangle∷Rectangle()

{
Length = 0.0;

Width = 0.0;

Void Rectangle∷setLength()

Length = 5.0;

Void Rectangle∷setWidth()

Width = 4.0;

Void Rectangle∷computeArea()

Cout ≪ “Area of Rectangle: “ ≪ length * width ≪ endl;

}
Rectangle∷~Rectangle()

Main()

Int run = 1;

String option, choice;

Cout≪”\t\t*******************SCIENTIFIC CALCAULATOR*******************”≪endl;

Cout≪”\t\t*******************BC1234567890*******************”≪endl;

Cout≪”\t\t*******************BY: Abdul Hadi E Services*******************”≪endl;

While(run)

Cout ≪ “\nOPTION 1 for computing Area and Circumference of the circle” ≪ endl;

Cout ≪ “OPTION 2 for computing Area of the Rectangle” ≪ endl;

Cout ≪ “Select your desired option(1-2): “;


Cin ≫ option;

If(option == “1”)

Circle nCircle;

nCircle.setRadius();

nCircle.computeAreaCirc();

cout ≪ “Do you want to perform anyother calculation(Y/N):”;

cin ≫ choice;

if(choice == “Y” || choice == “y”)

Continue;

Else

{
Break;

Else if(option == “2”)

Rectangle nRectangle;

nRectangle.setLength();

nRectangle.setWidth();

nRectangle.computeArea();

cout ≪ “Do you want to perform anyother calculation(Y/N):”;

cin ≫ choice;

if(choice == “Y” || choice == “y”)

Continue;

}
Else

Break;

Else

Cout ≪ “Invalid Option‼, Option should be from (1-2)” ≪ endl;

You might also like