Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can any one help me with the following questions: I need pseudocode and class di

ID: 3563875 • Letter: C

Question

Can any one help me with the following questions: I need pseudocode and class diagram for the following.

a. Design a class named Circle with fields named radius, area, and diameter. Include a constructor that sets the radius to 1. Include get methods for each field, but include a set method only for the radius. When the radius is set, do not allow it to be zero or a negative number. When the radius is set, calculate the diameter (twice the radius) and the area (the radius squared times pi, which is approximately 3.14). Create the class diagram and write the pseudocode that defines the class.

b. Design an application that declares two Circles. Set the radius of one manually, but allow the other to use the default value supplied by the constructor. Then, display each Circle

Explanation / Answer

Q A:
ANSWER:
class Circle
{
   private:
       fields named radius, area,
   public:
       constructor that sets the radius to 1
       method include get methods for each field
       method include a set method only for the radius   //radius is set, do not allow it to be zero or a negative number.
       method calculate the diameter (twice the radius)
       method the area (the radius squared times pi, which is approximately 3.14)
};
Q2 :
ANSWER
#include <iostream>
#include <stdio.h>
using namespace std;


class Circle11
{
private:
   int radius,dia,area;
public:
   Circle11(int val=0)
   {
       radius=val;
   }
   int getra()
   {
       return radius;
   }
   int getdia()
   {
       return dia;
   }
   int getare()
   {
       return area;
   }
   void set(int val)
   {
       radius=val;
   }
   int diam()
   {
       dia=2*radius;
       return dia;
   }
   int arrea()
   {
       area=2*3.14*radius*radius;
       return area;
   }
};

int mian()
{
   Circle11 obj;   //default val assigned
   //Circle11 obj1(11);//manuall value assigned
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote