Question
Dont know what goes in my main file I have the cpp file of Circle class and header File of Circle class. This program is
Dont know what goes in my main file I have the cpp file of Circle class and header File of Circle class. This program is in c++
// header file of cirlce class
#ifndef CIRCLE_H #define CIRLCE_H
class Circle { public: Circle(); Circle(double); double getArea() const; double getRadius() const; void setRadius(double); static int getNumberOfObjects(); bool operator (const Circle& other); bool operator >=(const Circle& other);
private: double radius; static int numberOfObjects; }; #endif
// cpp file of circle class
include "Circle.h"
Circle::Circle(){ radius = 0; numberOfObjects++; } int Circle::numberOfObjects = 0; Circle::Circle(double r){ radius = r; numberOfObjects++; } double Circle::getArea() const{ return 3.14*radius*radius; } double Circle::getRadius() const{ return radius; } void Circle::setRadius(double r){ radius = r; } int Circle::getNumberOfObjects(){ return numberOfObjects; } // overloaded operator bool Circle::operator >(const Circle& other) { if(radius > other.radius) { return true; }else return false; } // overloaded >= operator bool Circle::operator >=(const Circle& other) { if(radius >= other.radius) { return true; }else return false; }
// My main file
#include
void Prog14_1() { double sum = 0; //Use for loop block to create objects and invoke functions for 100 times. for(int i = 1; i
}
void Prog14_2() { // Create and initialize two rational numbers r1 and r2. Rational r1(4, 2); Rational r2(2, 3);
// Test toString, add, substract, multiply, and divide cout
// Test intValue and double cout
// Test compareTo and equal cout
}
void Prog14_3() {
}
void Prog14_4() { StackOfIntegers s; s.push(1); s.push(2);
s[0] = 999;
cout
}
void Prog14_7() {
}
int main() { while (true) { system("cls"); cout > exercise; cout 14.3 (The Circle class) Implement the relational operators st) in the Circle class in Listing 10.9, CircleWithConstantMemberFunctions.h, to order the Circle objects according to their radii
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