Write three classes named point circle and cylinder

Assignment Help C/C++ Programming
Reference no: EM131918554

Assignment: Points, Circles, and Cylinders Requirements

Your task is to write three classes named Point, Circle, and Cylinder. Each should have a .h and a .cpp file. Point is the base class. Circle inherits from Point. Cylinder inherits from Circle. Each class needs a constructor and an overloaded insertion operator (<<).

The following main.cpp file:

#include <iostream>
#include "point.h"
#include "circle.h"
#include "cylinder.h"

using namespace std;

int main()
{
Point p(4,4); // x coordinate, y coordinate
Circle c(5,5,5); // x, y, radius
Cylinder y (6, 6, 6, 6); // x, y, r, height

cout << p << endl << endl;
cout << c << " " << endl << (Point) c << endl << endl;
cout << y << " " << endl << (Circle) y << " " << endl << (Point) y
<< endl << endl;

return 0;
}

produces this output:

Point at (4, 4)

Circle with center = (5, 5); Radius = 5; Area = 78.5397
Point at (5, 5)

Cylinder with center = (6, 6); Radius = 6; Height = 6; Volume = 678.583
Circle with center = (6, 6); Radius = 6; Area = 113.097
Point at (6, 6)

Submit 6 files (point.h, point.cpp, circle.h, circle.cpp, cylinder.h, and cylinder.cpp) combined as a single zip file. The graders will compile your source along with their main.cpp to test program functionality.

Reference no: EM131918554

Questions Cloud

How can cloud computing enhance business value : Compose a research paper by addressing the following research question: How can cloud computing enhance business value?
What is a corner point : What is a corner point? Why do solutions to linear-programming problems focus on corner points?
Facility layouts report : Facility Layouts Report Describe the following facility layout formats used in manufacturing:
Performance appraisal process of an organization : Select and briefly describe the training process and the performance appraisal process of an organization
Write three classes named point circle and cylinder : Write three classes named Point, Circle, and Cylinder. Each should have a .h and a .cpp file. Point is the base class. Circle inherits from Point.
Briefly outline each of the elements of customer value : Define Customer Value and briefly outline each of the elements of Customer Value (cost, time, place, form, experience, performance and problem solving).
What is statistical inference : What is statistical inference? What is the difference between and sample and a population? Which one is the basis of statistical inference?
How is fourth amendment applied to computer investigations : How is the Fourth Amendment applied to computer investigations? What problems might arise because of this Amendment?
What is impact of the fed policy on the equity market : What is the impact of the Fed Policy on the equity market (last 10 years, say)?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program using a function and a switch statement

Write a program using a function and a switch statement. The user should be prompted to enter a number in main.

  Define the cheetah constructor to accept and initialize

Design and implement a class called Cheetah that contains instance data that represents the cheetah's name, age, weight, length and gender.

  Compute triangle area

Write a program with a form that contains three labels & text boxes (Base, Height & Area) in addition to a button labeled compute Triangle Area. The user must enter the base and height to find the area. (Triangle Area = 0. 5base x Height)

  Create a program reads in a senctence and encodes it

Create a program reads in a senctence and encodes it. Ask the user for the sentence, a mulitplier and an adder.

  When should an attribute of a class be static

Is there ever a reason to have a public attribute in a class?

  Compare the running time of two versions of the insertion

implement Uniform Random Number generator and Generate 1000 Random number between 0 an 10000. Try to use insertion sort to sort them. Compare the running time of two versions of the insertion sort.

  Prompt the user for and read 6 numbers

Write a program using an array that will store input data. Prompt the user for and read 6 numbers between 70 and 90. Verify the numbers should be greater than 70 and less than 90. If the number is less than or equal to 70 or greater than 90, repro..

  The main program should create an ifstream

For decryption, the main program should create an ifstream for the file to be decrypted. It should use the getline method of the ifstream to read lines from the file, call the encryption / decryption function with the line to be decrypted, and dis..

  Create a detailed ipo chart

Create a detailed IPO chart that also includes the algorithm from the attached c++ source code.

  Calculate the gross pay of an employee

Write a program to calculate the gross pay of an employee based on the number of hours worked and rate of payment - Write a program to take two numbers

  Write code that declares an int array named month

Write code that declares an int array named month with 5 rows and 7 coloumns and initializes every element to -1.

  Prepare a set of non-functional requirements

Prepare a set of non-functional requirements, including operational, performance security, and cultural and political for the fore mentioned scenario:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd