Each of the following class declarations has errors. Locate as many as you can.
A) class Box
{
private:
double width;
double length;
double height;
public:
Box(double w, 1, h)
{ width =w; length = 1; height = h; }
Box (Box b) // Copy constructor
{ width = b.width;
length = b.length;
height = b.height; }
... Other member functions follow ...
};
B). class Circle
{
private:
double diameter;
int centerX;
int centerY;
public:
Circle(double d, int x, int y)
{ diameter = d; centerX = x; centerY = y; }
// Overloaded = operator
void Circle=(Circle &right)
{ diameter = right.diameter;
centerX = right.centerX;
centerY = right.centerY; }
... Other member functions follow ...
};
C). class Point
{
private:
int xCoord;
int yCoord;
public:
Point (int x, int y)
{ xCoord = x; yCoord = y; }
// Overloaded + operator
void operator+(const &Point Right)
{ xCoord += right.xCoord;
yCoord += right.yCoord;
};
... Other member functions follow...
};
D) class Box
{
private:
double width;
double length;
double height;
public:
Box(double w, 1, h)
{ width = w; length = 1; height = h; }
// Overloaded prefix ++operator
void operator++ ()
{ ++width; ++length; }
// Overloaded postfix ++ operator
void operator++ ()
{width++; length++; }
... Other member functions follow ...
};
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
STARTING OUT WITH C++ MPL
Additional Engineering Textbook Solutions
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out With Visual Basic (8th Edition)
- #pyhton programing topic: Introduction to Method and Designing class Method overloading & Constructor overloading ------------------ please find the attached imagearrow_forwardProblem: Employee and ProductionWorker Classes Write a python class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: • Shift number (an integer, such as 1, 2, or 3)• Hourly pay rateThe workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for this class. Once you have written the class, write a program that creates an object of the ProductionWorker class, and prompts the user to enter data for each of the object’s data attributes. Store the data in the object, then use the object’s accessor methods to retrieve it and display it on the screen Note: The program should be written in python. Sample Input/Output: Enter the name: Ahmed Al-AliEnter the ID number: 12345Enter the department:…arrow_forwardC++ Programming Assignment 6 Dynamic Pets The objective of this lab is to demonstrate dynamic allocation and deallocation of memory. Instructions: Write a class called Pet that contains an animal’s name, type, and weight. Include a default constructor and destructor for the class. The constructor should print out the following message: “Creating a new pet”. The destructor should print out the following message: “In the Pet destructor.” Include appropriate get/set functions for the class. In main(), prompt the user to enter the number of pets in his or her household. Dynamically create a built-in array based on this number (not a vector or object of the array class) to hold pointers to Pet objects. Construct a loop in main() that executes once for each of the number of pets that the user indicated. Within this loop, ask the user to enter the name and type of pet. Using a random number generator, generate a weight between 1-100 pounds. Seed this random number generator with 100.…arrow_forward
- Cruise Recreational Activities Example Recreational activities include things like aerobics, shuffle board, and swimming. Each activity is identified by an activity code and includes other information such as description. Classes are offered for each activity. A class is uniquely identified by a combination of the activity code and the day/time at which it is held. It is assumed that a specific class will never be offered for the same activity at the same day and time, although it could be offered on a different day and/or time. Other information about a class includes the enrollment limit and the current enrollment count. A class will never include more than one activity. A passenger can sign up for a class as long as there is sufficient room in the class. Passengers are identified by a unique passenger number. Other information stored about passengers includes name, address, and age. Passengers have no limit on the number and type of classes they can sign up for. When they…arrow_forwardTrue or false A class can have self-referential data membersarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education