Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 3/3 in visual studio please! noble.cpp file // Q2b: Define displayRoom() for Noble class (5 points) // Define the function displayRoom() that you declared

Part 3/3 in visual studio please!

noble.cpp file

// Q2b: Define displayRoom() for Noble class (5 points) // Define the function displayRoom() that you declared within the Noble class in the header file // See expected output in question file.

// (displayList() function in the hw7.cpp should call this function.) // Include necessary header files

#include "room.h" #include "noble.h"

#include

void Noble::displayRoom() { // notice that no function call is needed becasue we know this is Noble class function }

Noble.h file

#ifndef _NOBLE_H_ #define _NOBLE_H_ // Q1b: Create Noble class (5 points) // Part 1: Create a child class of the Room class named 'Noble'

// Part2: Declare constructor which accepts the same 3 parameters as the parent class Room's constructor. // Pass the 3 parameters to the super constructor of the Room class.

// Part 3: Re-declare the method displayRoom (virtual method found inside of parent class Room)

#endif // _NOBLE_H_

Room.cpp file

#include "room.h"

// definitions of Room member functions Room::Room(string roomName, int noOfRooms, libraryType libType) { name = roomName; no = noOfRooms; lib = libType; }

string Room::getName() { return name; }

int Room::getNo() { return no; }

libraryType Room::getLibraryType() { return lib; }

room.h file

#ifndef _ROOM_H_ #define _ROOM_H_

#include using namespace std;

enum libraryType { hayden = 0, noble }; // definition of libraryType

class Room { private: string name; // private data members int no; libraryType lib;

public: Room(string roomName, int noOfRooms, libraryType libType); // constructor

// accessor methods string getName(); int getNo(); libraryType getLibraryType();

virtual void displayRoom() {}

// Q3a: Declare Friend Function changeLibraryType() (1 point) // Declare a friend function named changeLibraryType() which has 2 parameters and no return value. // The first parameter is a pointer to Room class, and the second is an integer which is the new Library type. // You need to define this function in hw7.cpp and call this function in case 'c' of executeAction() in hw7.cpp file

};

#endif // _ROOM_H_

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

Students also viewed these Databases questions

Question

an element of formality in the workplace between different levels;

Answered: 1 week ago