Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Make sure your Assignment 1's class* contains at least one (1) numeric attribute (int, float, double). If it does not, add a numeric attribute
Make sure your Assignment 1's class* contains at least one (1) numeric attribute (int, float, double). If it does not, add a numeric attribute to your class. Define the behavior of the following operators in your class' objects: Two objects of that class are considered equal (==) if ... The sum (+) of two objects of that class returns.... When passing one object of that class to cout operator, it displays... Using those definitions, modify your class to overload those operators. In the corresponding operator overloading function add a comment that explains the operator functionality (i.e. the definition of each operators). * If you received feedback related to your Assignment 1's class, update it appropriately before using it in this assignment. In the main program Create three objects of your Assignments 1's class and demonstrate that ==, +, and cout operators works as expected when using them with your class' objects. Submission Files to submit: Visual Studio solution/project files. Class files (.h and .cpp) . Main program (.cpp) Submit the Visual Studio project in a zip folder. Example of expected submission Note: The Solution/project files are not presented in these examples since those are automatically generated by Visual Studio. However, those are expected in students' submission. GroupCohesiveness.h #include class GroupCohesiveness { private: int answer, answer1, answer2, answer3; public: Submit the Visual Studio project in a zip folder. Example of expected submission Note: The Solution/project files are not presented in these examples since those are automatically generated by Visual Studio. However, those are expected in students' submission. GroupCohesiveness.h #include class GroupCohesiveness { private: int answere, answer1, answer2, answer3; public: }; void setAnswer(int a); void setAnswer1(int a); void setAnswer 2(int a); void setAnswer3(int a); int getAnswer@() const; int getAnswer1() const; int getAnswer2() const; int getAnswer3() const; float getGroupCohesiveness() const; bool operator= (const GroupCohesiveness& survey2) const; GroupCohesiveness operator (const GroupCohesiveness& survey2) const; friend ostreams operator < =1 && a -1 && a -1 && a -1 && a GroupCohesiveness temp; temp.answer0=(answer0+survey2.answer0)/2; temp.answer1=(answer1+survey2.answer1)/2; temp.answer2=(answer 2+survey2.answer 2)/2; temp.answer3=(answer3+survey2.answer3)/2; return temp; } // When passing one object of that class to cout operator, it displays the answers of the surveys enclosed by parentheses. friend ostream& operator < main.cpp + x assignment01.h Miscellaneous Files - No Configurations 1 2 Assignment01.cpp #include #include "assignment01.h" using namespace std; RacingCar* car = new RacingCar(); int speed, year, MPG, price; cout < > speed; car->setspeed (speed); 3 4 5 Bint main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 25 26 27 28 29 30 33 1222222222223 cout < < "Enter year: "; cin >> year; car->setyear(year); cout < < "Enter MPG: "; cin >> MPG; car->setMPG(MPG); cout < < "Enter price: "; cin >> price; car->setprice(price); cout < < "Speed: " < < car->getspeed() < < endl; cout < < "Year: " < < car->getyear() < < endl; cout < < "MPG: " < < car->getMPG() < < endl; cout < < "Price: " < < car->getprice() < < endl; (Global Scope) cout < < "Racing car value: " < < car->getRacingCar() < < endl; delete car; return 0; 100% No issues found Output Show output from: main.cpp assignment01.h Assignment01.cpp Miscellaneous Files - No Configurations 1 #include 123 using namespace std; Eclass Racing Car { private: int speed, year, MPG, price; public: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 [}; void setspeed(int a); void setyear(int b); void setMPG(int c); void setprice (int d); int getspeed() const; int getyear() const; int getMPG() const; int getprice() const; float getRacing Car() const; RacingCar(); Racing Car(int speed, int year, int MPG, int price); ~RacingCar(); Miscellaneous Files - No Configurations #include "assignment01.h" 2 using namespace std; 123456789 10 11 12 13 14 15 16 17 18 Evoid RacingCar::setspeed (int a) { if (a >= 60 && a = 2000 && b = 20 && c = 50000 && d
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started