Question

Given the following class definition in the file Classroom.h, which XXX and YYY complete the corresponding.cpp file? #ifndef
#include Classroom.h void Class Room::Print) const #include Classroom.cpp void Classroom.Print) const #include <Class Roo
Complete the correct code for inserting a node in a list InsertAfter(IntNode* nodeloc) { IntNode* tmpNext - nullptr; XXX w tm
Consider that there is a class Team for soccer team members under Soccer namespace and another class Team for basket team mem
Which XXX is used for the member function Display definition in the following code? Class Student public void Setlone(string
A soccer coach scouting players has to enter the jersey number of players and print a list of those numbers when required. Id
0 0
Add a comment Improve this question Transcribed image text
Answer #1

***Please upvote if you liked the answers***

1 The correct answer is :-

#include "ClassRoom.h"

void ClassRoom::Print() const

Explanation:- The first code snippet is a header file which contains the class declaration.So it is included in the second file

As the function Print is defined outside the class,we need to use the scope resolution operator syntax to denote that it belongs to the class.

2 The correct answer is:- tmpNext = this->nextNodePtr;
this->nextNodePtr = nodeLoc;
nodeLoc->nextNodePtr = tmpNext;

Explanation:-

As nextNodePtr is not passed into the method,so it must be a class member.The this pointer helps to access a class member and the syntax is always this-> followed by member name.

3 The correct answer is:-

Soccer::Team SoccerTeamMembers

BasketBall:Team BasketBallTeamMembers

Explanation:- Only way to access entities (variables or classes ) inside namespaces is using the scope operator.All other options are hence invalid

4  The correct answer is:- void Student::Display()

  Explanation:- The correct syntax is <classname> + scope resolution operator + <method name>

5 The correct answer is:- push_back()

Explanation:- Doesn't need sort() as the numbers are to be printed any order. append() is used in case of strings,so not applicable,at() function is used to fetch a value at a certain position from a vector,so not applicable either.

Add a comment
Know the answer?
Add Answer to:
Given the following class definition in the file Classroom.h, which XXX and YYY complete the corresponding.cpp...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Modify the code to append the additional numbers: 30, -30, 90, -1, 100, 40, and 6...

    Modify the code to append the additional numbers: 30, -30, 90, -1, 100, 40, and 6 Implement the Prepend function (hint: think of how you can modify the append function) Prepend 5 to the linked list code must be done in c++ #include <iostream> #include <cstdlib> #include <ctime> using namespace std; class IntNode { public: IntNode(int dataInit = 0, IntNode* nextLoc = nullptr); void InsertAfter(IntNode* nodePtr); IntNode* GetNext(); void PrintNodeData(); IntNode* Append(int dataVal); private: int dataVal; IntNode* nextNodePtr; }; //...

  • JAVA PROGRAMMING Given main(), complete the SongNode class to include the printSongInfo() method. Then write the...

    JAVA PROGRAMMING Given main(), complete the SongNode class to include the printSongInfo() method. Then write the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the dummy head node. Ex: If the input is: Stomp! 380 The Brothers Johnson The Dude 337 Quincy Jones You Don't Own Me 151 Lesley Gore -1 the output is: LIST OF SONGS ------------- Title: Stomp! Length: 380 Artist: The Brothers Johnson Title: The Dude Length: 337 Artist: Quincy Jones...

  • Write a C++ Program. You have a following class as a header file (dayType.h) and main()....

    Write a C++ Program. You have a following class as a header file (dayType.h) and main(). #ifndef H_dayType #define H_dayType #include <string> using namespace std; class dayType { public:     static string weekDays[7];     void print() const;     string nextDay() const;     string prevDay() const;     void addDay(int nDays);     void setDay(string d);     string getDay() const;     dayType();     dayType(string d); private:     string weekDay; }; #endif /* // Name: Your Name // ID: Your ID */ #include <iostream>...

  • Info: The next question related to the Exam class whose definition (.h file) is shown below....

    Info: The next question related to the Exam class whose definition (.h file) is shown below. This Exam class represents a certain student’s test score. #include <string> namespace cs31 { class Exam { public: Exam ( std::string student, int score = 90 ); bool equal( const Exam & e1, const Exam & e2 ) const; int getScore() const; std::string getStudent() const; private: std::string mName; // Exam’s Student name int mScore; // Exam’s Student Score }; } 1a) Suppose we decide...

  • This is for my c++ class and im stuck. Complete the Multiplex.cpp file with definitions for a fun...

    This is for my c++ class and im stuck. Complete the Multiplex.cpp file with definitions for a function and three overloaded operators. You don't need to change anything in the Multiplex.h file or the main.cpp, though if you want to change the names of the movies or concession stands set up in main, that's fine. Project Description: A Multiplex is a complex with multiple movie theater screens and a variety of concession stands. It includes two vectors: screenings holds pointers...

  • 10.18 LAB: Plant information (vector) Given a base Plant class and a derived Flower class, complete...

    10.18 LAB: Plant information (vector) Given a base Plant class and a derived Flower class, complete main() to create a vector called myGarden. The vector should be able to store objects that belong to the Plant class or the Flower class. Create a function called PrintVector(), that uses the PrintInfo() functions defined in the respective classes and prints each element in myGarden. The program should read plants or flowers from input (ending with -1), adding each Plant or Flower to...

  • The following program contains the definition of a class called List, a class called Date and...

    The following program contains the definition of a class called List, a class called Date and a main program. Create a template out of the List class so that it can contain not just integers which is how it is now, but any data type, including user defined data types, such as objects of Date class. The main program is given so that you will know what to test your template with. It first creates a List of integers and...

  • Header file for the Rational class: #ifndef RATIONAL_H #define RATIONAL_H class Rational { public: Rational( int...

    Header file for the Rational class: #ifndef RATIONAL_H #define RATIONAL_H class Rational { public: Rational( int = 0, int = 1 ); // default constructor Rational addition( const Rational & ) const; // function addition Rational subtraction( const Rational & ) const; // function subtraction Rational multiplication( const Rational & ) const; // function multi. Rational division( const Rational & ) const; // function division void printRational () const; // print rational format void printRationalAsDouble() const; // print rational as...

  • -------c++-------- The Passport class takes a social security number and the location of a photo file. The Passport class has a Photo class member, which in a full-blown implementation would store the...

    -------c++-------- The Passport class takes a social security number and the location of a photo file. The Passport class has a Photo class member, which in a full-blown implementation would store the passport photo that belongs in that particular passport. This Photo class holds its location or file name and the pixel data of the image. In this lab the pixel data is only used to show how memory maybe used when a program uses large objects. We will not...

  • Write a C++ program that includes the following: Define the class Student in the header file Stu...

    Write a C++ program that includes the following: Define the class Student in the header file Student.h. #ifndef STUDENT_H #define STUDENT_H #include <string> #include <iostream> using namespace std; class Student { public: // Default constructor Student() { } // Creates a student with the specified id and name. Student(int id, const string& name) { } // Returns the student name. string get_name() const { } // Returns the student id. int get_id () const { } // Sets the student...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT