Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Question I will give a thumbs up if problem gets solved correctly!! Every circle has a center and a radius. Given the radius, we

C++ Question

I will give a thumbs up if problem gets solved correctly!!

Every circle has a center and a radius. Given the radius, we can determine the circle's area and circumference. Given the center, we can determine its position in the x-y plane. The center of a circle is a point in the x-y plane. Design the class Circle that can store the radius and center of the circle. Because the center is a point in the x-y plane and you designed the class to capture the properties of a point in Programming Exercise 3, you must derive the class Circle from the class Point. You should be able to perform the usual operations on a circle, such as setting the radius, printing the radius, calculating and printing the area and circumference, and carrying out the usual operations on the center.

Please proof the code and make the necessary corrections so it can compile/debug in Visual Studio 2019

main.cpp

01 #include "pointType.h"
02 #include "circleType.h"
03 #include
04 using namespace std;
05
06 int main()
07 {
08 double Coordinate_x;
09 double Coordinate_y;
10
11
12 cout << "Enter the x and y coordinate " << endl;
13 cin >> Coordinate_x >> Coordinate_y;
14 cout << "Enter the radus of the circle" <
15
16 cout << "The X and Y Coordinates are: (" <
17 << endl;
18 cout << "The Area if the circe ";
19 cout <, "The circumferance of the circke is ";
20
21 }

pointType.cpp

01 #include "pointType.h"
02 #include
03 #include
04 /*void pointType::setCoordinate(double x,double y)
05 {
06 Coordinate_x = x;
07 Coordinate_y = y;
08
09 }*/
10 void pointType::setCoordinate_x(double Coordinate_x)
11 {
12
13 }
14
15 void pointType::setCoordinate_y(double Coordinate_y)
16 {
17
18 }
19 void pointType::print()const
20 {
21
22 }
23
24 pointType::pointType()
25 {
26 double Coordinate_x= 0;
27 double Coordinate_y= 0 ;
28 }

pointType.h

01 #ifndef POINTTYPE_H_INCLUDED
02 #define POINTTYPE_H_INCLUDED
03 /*#pragma once*/
04 #include
05 using namespace std;
06 /*template */
07 class pointType
08 {
09 public:
10 void print()const;
11 /*void setCoordinate(double x = 0, double y = 0);*/
12 void setCoordinate_x(double Coordinate_x);
13 void setCoordinate_y(double Coordinate_y);
14 double getCoordinate_x () const;
15 double getCoordinate_y ()const;
16 pointType(void);
17 pointType (double Coordinate_x,double Coordinate_y);
18 ~pointType(void);
19
20 private:
21 double Coordinate_x;
22 double Coordinate_y;
23
24 };
25
26 #endif // POINTTYPE_H_INCLUDED

circleType.h

01 #ifndef CIRCLETYPE_H
02 #define CIRCLETYPE_H
03
04 #include
05
06
07 class circleType : public pointType
08 {
09 public:
10 void circleType(double Coordinate_x, double Coordinate_y,double Radus );
11 void print()const;
12 double setAreaOfCircle() const;
13 double setCircumference() const;
14 double getRadus () const;
15 circleType(double Coordinate_x, double Coordinate_y,double Radus);
16 ~circleType (void);//rest is from defalut
17 circleType();
18 virtual ~circleType();
19
20 private:
21 double Radus ()const;
22 double pie = 3.14;
23 };
24
25 #endif // CIRCLETYPE_H

src\circleType.cpp

01 #include "circleType.h"
02 #include "pointType.h"
03 #include
04 #include
05
06 double circleType::getRadus()const
07 {
08 return Radus; //ctor
09 }
10 double circleType::AreaOfCircle () const
11 {
12 return 3.14 * Radus*Radus;
13 }
14 double circleType::Circumference () const
15 {
16 return 3.14 *2*Radus;
17 }
18
19 circleType::circleType()
20 {
21 //ctor
22 }
23
24 circleType::~circleType()
25 {
26 //dtor
27 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions