Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The answer to the top question is \"Joe10\", and the bottom would be an error. I

ID: 673739 • Letter: T

Question

The answer to the top question is "Joe10", and the bottom would be an error. I just need help understandng why that is, and what process I should go through in order to get that answer. Thanks!

For 2 and 3 Assume you have the following Item class and it is fully implemented in C++: Class Item private: int quantity; string name; public: Item (string name, int quant); string GetName int GetQuantityO li What does the following print to the screen? (2 pts) Item *joe = new Item ("Joe", 3); Item jack ("Jack",10) cout

Explanation / Answer

Indeed this is correct.

For the first part the answer will be Joe10.

Basically we have created a class named Item where we have two variables quantity and name. There is a constructore for the class which takes in argument quantity and name and assign it to these variables.

Now for the first part we are declaring two objects. one with joe and other with jack.

Now while printing to the console we are printing joe.getname and jack.getquantity.

which will give us result as Joe10

In the second one the problem is that we are trying to declare the array of objects nd haven't done initilization of the objects.

They are calling stuff[4].getname which is not intialized.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote