Create a class called Point that has two data members: x- and y-coordinates of the point. Provide a no-argument and a 2-argument constructor. Provide separate get and set functions for the each of the data members i.e. getX, getY, setX, setY. The getter functions should return the corresponding values to the calling function. Provide a display method to display the point in (x, y) format. Make appropriate functions const. Derive a class Circle from this Point class that has an additional data member: radius of the circle. The point from which this circle is derived represents the center of circle. Provide a no-argument constructor to initialize the radius and center coordinates to 0. Provide a 2-argument constructor: one argument to initialize the radius of circle and the other argument to initialize the center of circle (provide an object of point class in the second argument). Provide a 3-argument constructor that takes three floats to initialize the radius, x-, and y-coordinates of the circle. Provide setter and getter functions for radius of the circle. Provide two functions to determine the radius and circumference of the circle. Write the main function to test this class.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.4: A Case Study: Constructing A Date Class
Problem 3E
icon
Related questions
Question

Create a class called Point that has two data members: x- and y-coordinates of the point. Provide a no-argument and a 2-argument constructor. Provide separate get and set functions for the each of
the data members i.e. getX, getY, setX, setY. The getter functions should return the corresponding values to the calling function. Provide a display method to display the point in (x, y) format. Make appropriate functions const.

Derive a class Circle from this Point class that has an additional data member: radius of the circle. The point from which this circle is derived represents the center of circle. Provide a no-argument constructor to initialize the radius and center coordinates to 0. Provide a 2-argument constructor: one argument to initialize the radius of circle and the other argument to initialize the center of circle (provide an object of point class in the second argument). Provide a 3-argument constructor that takes
three floats to initialize the radius, x-, and y-coordinates of the circle. Provide setter and getter functions for radius of the circle. Provide two functions to determine the radius and circumference of the circle.

Write the main function to test this class.

Create a class called Distance containing two members feet and inches. This class represents distance
measured in feet and inches. For this class, provide the following functions:
a. A no-argument constructor that initializes the data members to some fixed values.
b. A 2-argument constructor to initialize the values of feet and inches to the values sent from the
calling function at the time of creation of an object of type Distance.
c. AddDistance function to add two distances: Feet and inches of both objects should add in their
corresponding members. 12 inches constitute one foot. Make sure that the result of addition
doesn't violate this rule.
d. isGreater: should return a variable of type bool to indicate whether 1st distance is greater than
2nd or not.
e. issmaller: should return a variable of type bool to indicate whether 1st distance is smaller than
2nd or not.
f. isGreaterEqual: should return a variable of type bool to indicate whether 1st distance is greater
than or equal to 2nd or not.
g. isSmallerEqual: should return a variable of type bool to indicate whether 1st distance is smaller
than or equal to 2nd or not.
h. isEqual: should return a variable of type bool to indicate whether 1st distance is equal to the 2nd
distance or not.
i. isNotEqual: should return a true value if both the distances are not equal and return a false if
both are equal.
Write a main function to test this class.
Transcribed Image Text:Create a class called Distance containing two members feet and inches. This class represents distance measured in feet and inches. For this class, provide the following functions: a. A no-argument constructor that initializes the data members to some fixed values. b. A 2-argument constructor to initialize the values of feet and inches to the values sent from the calling function at the time of creation of an object of type Distance. c. AddDistance function to add two distances: Feet and inches of both objects should add in their corresponding members. 12 inches constitute one foot. Make sure that the result of addition doesn't violate this rule. d. isGreater: should return a variable of type bool to indicate whether 1st distance is greater than 2nd or not. e. issmaller: should return a variable of type bool to indicate whether 1st distance is smaller than 2nd or not. f. isGreaterEqual: should return a variable of type bool to indicate whether 1st distance is greater than or equal to 2nd or not. g. isSmallerEqual: should return a variable of type bool to indicate whether 1st distance is smaller than or equal to 2nd or not. h. isEqual: should return a variable of type bool to indicate whether 1st distance is equal to the 2nd distance or not. i. isNotEqual: should return a true value if both the distances are not equal and return a false if both are equal. Write a main function to test this class.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage