CS201 Assignment 3 Solution Spring 2021 | VU Planet | Pro Digital & Tech Guru

 


CS201 Assignment 3 Solution Spring 2021.CS201 Assignment 3 Solution.CS201 Assignment No 3 Solution Spring 2021.CS201 Assignment 3 Spring 2021 Solution.CS201 assignment solution Spring 2021.CS201 Assignment 3 solution 2021.CS201 assignment no 3 solution spring 2021 




Simply you can copy code from here and paste in dev++ software or you can download .cpp from down to the post.



# include <iostream>


# 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********SCIENTIFIC CALCULATOR******"<<endl; 

  cout<<"\t********Put your id here******"<<endl; 

  cout<<"\t********VU Planet******"<<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):"<<endl;

   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):";

     if(choice == "Y"  ||  choice == "y")

      {

      continue;

  }

    else

       {

        break;

   }

   }

   else

   {

    cout<< "Invalid Option!!, Option should be form (1-2)"<<endl;

    cout<< "Do you want to perform anyother calculation(Y/N)";

    cin>> choice;

      if(choice == "Y"  ||  choice == "y")

      {

      continue;

  }

    else

       {

        break;

   }

}

}

}








  Download From The Given Link
                                       
                 Click Here
If you have any problem let me know....!!


                                          



                                          

Post a Comment

Previous Post Next Post