Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this problem. C++ code Problem A) Implementing the Big Three for the Company Class and using s) 2 of 8 In ieclulc

Need help with this problem. C++ code

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Problem A) Implementing the Big Three for the Company Class and using s) 2 of 8 In ieclulc wc will discuss the Course class to demonstrate the use of dynamic memory in classes, and the need for implementing the copy constructor, destructor, and an overloaded version of the assignment operator when dynamic memory is used in a class (The Course Class and an example of its use will be posted on the Moodle site for this after we go over it in lecture). In this assignment you will implement the big three in similar fashion as they are implemented in the Course class for a different class, the Company class NOTE, there are differences between the two classes (Course and Company). You will have to account for the differences in your implementation of the methods, operators, and functions for the Company class. Specifically, in this assignment you will augment the program (that is, add the necessary C++ code) to what we provide by defining and using following methods, operators, and functions for the Company class 1) A Copy Constructor - creates a copy of an object of type Company when it is passed "by value" to a function, or when a programmer want to make a copy of an existing company object by calling it 2) A Destructor which deallocates the memory dynamically that was dynamically allocated when an instance of the class Company was created (e.g., the destructor is called when an object is deleted, when returning from a function that has a call-by-value parameter that is an object, and in other cases)) 3) An overloaded assignment operator, used when assigning one object of type Company to another object of type Company 4) An overloaded > (greater than) relational operator 5) A function that prints out the information stored in an object of class Company 6) A sort function that sorts an array of Company objects using the overloaded assignment operator ) and overloaded > (greater-than) operator that you define for the class ompany The C++ Code you are to augment for this assignment is in the file Company. cpp, and available on Moodle, with this assignment description. Overview of the Company Class - from the file Company. cpp in the HW 10 Assignment folder on Moodle. Note, the comments in the class definition for Company below describe what we have provided, and what we require you to implement. Problem A) Implementing the Big Three for the Company Class and using s) 2 of 8 In ieclulc wc will discuss the Course class to demonstrate the use of dynamic memory in classes, and the need for implementing the copy constructor, destructor, and an overloaded version of the assignment operator when dynamic memory is used in a class (The Course Class and an example of its use will be posted on the Moodle site for this after we go over it in lecture). In this assignment you will implement the big three in similar fashion as they are implemented in the Course class for a different class, the Company class NOTE, there are differences between the two classes (Course and Company). You will have to account for the differences in your implementation of the methods, operators, and functions for the Company class. Specifically, in this assignment you will augment the program (that is, add the necessary C++ code) to what we provide by defining and using following methods, operators, and functions for the Company class 1) A Copy Constructor - creates a copy of an object of type Company when it is passed "by value" to a function, or when a programmer want to make a copy of an existing company object by calling it 2) A Destructor which deallocates the memory dynamically that was dynamically allocated when an instance of the class Company was created (e.g., the destructor is called when an object is deleted, when returning from a function that has a call-by-value parameter that is an object, and in other cases)) 3) An overloaded assignment operator, used when assigning one object of type Company to another object of type Company 4) An overloaded > (greater than) relational operator 5) A function that prints out the information stored in an object of class Company 6) A sort function that sorts an array of Company objects using the overloaded assignment operator ) and overloaded > (greater-than) operator that you define for the class ompany The C++ Code you are to augment for this assignment is in the file Company. cpp, and available on Moodle, with this assignment description. Overview of the Company Class - from the file Company. cpp in the HW 10 Assignment folder on Moodle. Note, the comments in the class definition for Company below describe what we have provided, and what we require you to implement

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago