“CPT 341 VB.NET Project 3 | OOP Centroids Area” has been added to your cart. Continue shopping
Data Store Blog
Explore the latest insights, tutorials, and updates in web scraping, Python automation, and data mining—tailored for small businesses and data-driven entrepreneurs. Our blog empowers you to stay ahead of the curve, unlocking faster workflows and smarter decision-making through cutting-edge automation techniques.
Categories
- ACC 543
- Accounting
- Biology
- Business
- C Programming
- C++
- Calculus
- Chemical Engineering
- Chemistry
- Civil Engineering
- Communication
- Computer Science
- Computer Science
- CPT 341 Spring 2020
- Discussion
- Ecomonic
- Education
- Electric Engineering
- Engineering
- English
- Environmental Science & Engg
- Essay
- Excel
- Finance
- Health
- healthcare
- History
- Information Systems
- Introduction to sociology 2nd edition
- Java
- Java
- Law
- Mathematics
- Mechanical Engineering
- Men's Fashion
- NATV 1220
- Nursing
- Nutrition
- Operations Management
- Physics
- Programming
- PSYC 325 Final Exam
- Psychology
- Psychology
- Python
- Research Paper
- Social Sciences
- Statistics
- Statistics and Probability
- Uncategorized
- Visual Basic.NET
- Women's Fashion
The following program contains a cylinder class that represents a cylinder as a radius and a
The following program contains a Cylinder class that represents a cylinder as a radius and a height – see the diagram above. Implement the constructor and the volume method using the comments and the main function as a guide. For the constructor, you must use an initializer list to set the radius and height. The equation for the volume of a cylinder is volume = radius^2 * height. Your implementation will appear outside the class declaration, underneath the // FIXME comments.
“`
#include
#include
using namespace std;
class Cylinder {
public:
Cylinder(double r, double h);
double volume() const;
private:
double radius;
double height;
};
// FIXME: implement the Cylinder constructor to set radius and height
// You must use an initializer list to receive credit
// FIXME: implement the volume method to return the volume of the Cylinder object
int main() {
// create a Cylinder with radius = 2.0 and height = 5.0
Cylinder c(2.0, 5.0);
// should print 62.8 (maybe with more decimal places – it depends on the value you used for pi)
cout << c.volume() << endl; return 0; } ```