Question
1: Based on Program 13-1 in the textbook, create a class name Circle with the following declarations by completing missing methods. (Hint: you can use
1: Based on Program 13-1 in the textbook, create a class name Circle with the following declarations by completing missing methods.
(Hint: you can use PI=3.14.)
//Circle class declaration
class Circle
{
private:
double radius;
public:
void setRadius(double);
double getRadius () const;
double getArea () const;
double getPerimeter () const;
};
2. Program: Circle.h and newCircle.cpp
a) Create a class specification file, Circle.h, that contains the Circle class declaration
b) Create a class implementation file, Circle.cpp, that contains the member function definition, with a constructor that can accept arguments
c) Create a program, newCircle.cpp, that generate two instances of the Circle class
d) Based on Program 13-8 in the textbook, create two instances of the Circle class, pizza1 and pizza2, which can have different size (radius).
Hint: Use the example source code in Rectangle Version 4.zip to create a multi-file project.
Step 1: In Dev-C++, go to file -> New -> Project to create an empty project
Setp 2: Go to Project -> Add to project, add new cpp files and header files (e.g. Rectangle.cpp and Pr13-8.cpp).
Step 3: Compile and run
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