Write a program that creates a circle class and uses it

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

Please help code the highlighted lab I am very confused on it, reminder im using c++

Write a program that creates a Circle class and uses it to find out how far apart the centers of Circle objects are. Recall that at the very least CIrcle Objects will need to have radius, center_x, and center_y as data members.

The class should have a default constructor to set radius = 1 and to place the center at (0,0).

It hsould also have a constructor to allow three values to be initialized with user-supplied data when a Circle object is created. It should laso have functions to set and to get each of the data members.

Include an overloaded subtraction operator that return how far apart two Circle object centers are.

It must not return any negative numbers. Ex circle1 = (3,2) circle2 = (4,4) when subtracted should return 2.236 not -2.236.

Have the program create a pair of Circle objects and then output where their centers are and how far apart they are. Display the result to 3 decimal points.

Sample Output

circle1 center: (3,2)

circle2 center: (4,4)

The two circles are 2.236 units apart.

Here is the coding I have started so far.

#include <iostream>

#include <string>

using namespace std;

class Circles

{

private:

double radius;

double center_x, center_y;

double amount;

public:

Circles Circles::SetValue()

{

radius = 1;

center_x = 0;

center_y = 0;

amount = 0;

}

Circles Circles::GetValue(double r, double x, double y) // Constructor

{

radius = r;

center_x = x;

center_y = y;

}

Circles Circles::FindValue(double radius, double center_x, double center_y)

{

}

void printCircles() const

{

cout << "clircle1 ceneter ( " << center_x << ", " << center_y << " )" << endl;

cout << "clircle2 ceneter ( " << center_x << ", " << center_y << " )" << endl;

cout << " The two circles are " << amount << " units apart." << endl;

}

};

 

Reference no: EM132095852

Questions Cloud

Calculate the amount of the allowance for doubtful accounts : Calculate the amount of the Allowance for Doubtful Accounts that should appear on the December 31, of the current year, balance sheet
Make a digital clock with the time display in the format : Take the hour and minute, display the hour and minute in the format of HH:MM on the 4-bank seven segment LED display for 1 minute.
Develop a six sigma-type project employing the dmaic steps : Develop a Six Sigma-type project employing the DMAIC steps for improving any phase of your work or personal life that you feel may be "defective."
Identify any legislative regulatory framework : Identify any legislative regulatory framework/s affecting the MNC you have identified operating in Australia and discuss why and how it affects the company.
Write a program that creates a circle class and uses it : Write a program that creates a Circle class and uses it to find out how far apart the centers of Circle objects are.
Determine the proper inventory balance for werth company : Werth uses the periodic method of recording inventory. Determine the proper inventory balance for Werth Company at December 31, 2010
Identify preferred style of learning : Section 3 assists you to identify how you learn new skills and knowledge. In order to identify your preferred style of learning, complete the following tasks
Discuss the application of wireless technologies in a field : Discuss the application of wireless technologies in a field which you find most interesting (i.e. healthcare, home automation, transportation).
Project feasibility study and timeline : You are required to read a case study on a residential development project and prepare a Project Feasibility Study and Timeline

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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