Program: Circle.h and newCircle.cpp 1: Create a class specification file, Circle.h, that contains the Circle class declaration 2: Create a class implementation file, Circle.cpp, that contains the member function definition, with a constructor that can accept arguments 3. Based on Program 13-8 in the textbook, create a program, newCircle.cpp, that generate 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 (e.g. Rectangle.cpp and Pr13-8.cpp files). Step 3: Compile and run
1: Create a class specification file, Circle.h, that contains the Circle class declaration
2: Create a class implementation file, Circle.cpp, that contains the member function definition, with a constructor that can accept arguments
3. Based on Program 13-8 in the textbook, create a program, newCircle.cpp, that generate 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 (e.g. Rectangle.cpp and Pr13-8.cpp files).
- Step 3: Compile and run
Problem 2:
Read the example source code in “HW2Problem2.zip” and modify it as follows:
1. Modify the code and create three rectangle objects, box1, box2, and box3.
2. Modify the code and create some static member function(s) that can count the number of objects created.
3. Modify the code so that each rectangle object will have a price that is based on the area of the box: . Modify static member function, getTotal, so that it can still compute the total price for all existing objects. (Note: the example only gives fixed price for each box.)
Step by step
Solved in 3 steps