Question
Please complete Circle.h file and write Cycle.cpp files in C++ . Cycle.h file is just below main file. Thanks //****************************Main File************************* #include Circle.h #include #include
Please complete Circle.h file and write Cycle.cpp files in C++. Cycle.h file is just below main file. Thanks
//****************************Main File*************************
#include "Circle.h"
#include
#include
int main()
{
std::cout << std::fixed << std::showpoint << std::setprecision(2);
{
std::cout << "Circle Tester #1 ";
// Create and display the Circle object.
Circle circle1(8.0);
std::cout << "CIRCLE 1: " << circle1 << " ";
Circle circle2(5.0);
std::cout << "CIRCLE 2: " << circle2 << " ";
// test the addition and subtraction operators
Circle circle3 = circle1 + circle2;
std::cout << "CIRCLE 3 (CIRCLE1 + CIRCLE2): " << circle3 << " ";
Circle circle4 = circle1 - circle2;
std::cout << "CIRCLE 4 (CIRCLE1 - CIRCLE2): " << circle4 << " ";
// test the increment operator
std::cout << "CIRCLE 4 after ++: " << ++circle4 << " ";
}
std::cout << "============================================== ";
{
std::cout << "Circle Tester #2 ";
// Create and display another Circle object.
Circle circle1(20.0);
std::cout << "CIRCLE 1: " << circle1 << " ";
Circle circle2(10.0);
std::cout << "CIRCLE 2: " << circle2 << " ";
// test the addition and subtraction operators
Circle circle3 = circle1 + circle2;
std::cout << "CIRCLE 3 (CIRCLE1 + CIRCLE2): " << circle3 << " ";
Circle circle4 = circle1 - circle2;
std::cout << "CIRCLE 4 (CIRCLE1 - CIRCLE2): " << circle4 << " ";
// test the increment operator
std::cout << "CIRCLE 4 after ++: " << ++circle4 << " ";
}
}
//**************************** please complete Cycle.h below and write Cycle.cpp
#ifndef CIRCLE_H
#define CIRCLE_H
#include
const double PI = 3.14159;
class Circle
{
// Overloded insertion operator
public:
// Constructors
// Accessor functions
// Function setRadius
// Overloaded operators
// Destructor
private:
// This is not the most appropriate syntax,
// because there is no need to have a pointer
// to a dynamic variable storing the radius,
// but this is done to help you learn which
// operators you need to use.
double pi;
double *radius;
};
#endif
//**********************************This is the expected output when we run main.cpp file
Circle Tester #1 CIRCLE 1: radius=8.00 | diameter=16.00 | circumference=50.27 | area=201.06 CIRCLE 2: radius=5.00 | diameter=10.00 | circumference=31.42 | area=78.54 CIRCLE 3 (CIRCLE1 + CIRCLE2): radius=13.00 | diameter=26.00 | circumference=81.68 | area=530.93 CIRCLE 4 (CIRCLE1 - CIRCLE2): radius=3.00 | diameter=6.00 | circumference=18.85 | area=28.27 CIRCLE 4 after ++: radius=4.00 | diameter=8.00 | circumference=25.13 | area=50.27 ============================================== Circle Tester #2 CIRCLE 1: radius=20.00 | diameter=40.00 | circumference=125.66 | area=1256.64 CIRCLE 2: radius=10.00 | diameter=20.00 | circumference=62.83 | area=314.16 CIRCLE 3 (CIRCLE1 + CIRCLE2): radius=30.00 | diameter=60.00 | circumference=188.50 | area=2827.43 CIRCLE 4 (CIRCLE1 - CIRCLE2): radius=10.00 | diameter=20.00 | circumference=62.83 | area=314.16 CIRCLE 4 after ++: radius=11.00 | diameter=22.00 | circumference=69.11 | area=380.13
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started