Question: Please write the functions described. Will rate for a correct answer!! Here is countrynetwork.cpp: /****************************************************************/ /* CountryNetwork Implementation */ /****************************************************************/ /* TODO: Implement the member
Please write the functions described. Will rate for a correct answer!!


Here is countrynetwork.cpp:
/****************************************************************/
/* CountryNetwork Implementation */
/****************************************************************/
/* TODO: Implement the member functions of class CountryNetwork */
/* This class uses a linked-list of Country structs to */
/* represet communication paths between nations */
/****************************************************************/
#include "CountryNetwork.hpp"
using namespace std;
/*
* Purpose: Constructer for empty linked list
* @param none
* @return none
*/
CountryNetwork::CountryNetwork()
{
}
/*
* Purpose: Check if list is empty
* @return true if empty; else false
*/
bool CountryNetwork::isEmpty()
{
}
/*
* Purpose: Add a new Country to the network
* between the Country *previous and the Country that follows it in the network.
* @param previous name of the Country that comes before the new Country
* @param countryName name of the new Country
* @return none
*/
void CountryNetwork::insertCountry(Country* previous, string countryName)
{
}
/*
* Purpose: delete the country in the network with the specified name.
* @param countryName name of the country to delete in the network
* @return none
*/
void CountryNetwork::deleteCountry(string countryName)
{
}
/*
* Purpose: populates the network with the predetermined countries
* @param none
* @return none
*/
void CountryNetwork::loadDefaultSetup()
{
}
/*
* Purpose: Search the network for the specified country and return a pointer to that node
* @param countryName name of the country to look for in network
* @return pointer to node of countryName, or NULL if not found
* @see insertCountry, deletecountry
*/
Country* CountryNetwork::searchNetwork(string countryName)
{
}
/*
* Purpose: deletes all countries in the network starting at the head country.
* @param none
* @return none
*/
void CountryNetwork::deleteEntireNetwork()
{
}
/*
* Purpose: Transmit a message across the network to the
* receiver. Msg should be stored in each country it arrives
* at, and should increment that country's count.
* @param receiver name of the country to receive the message
* @param message the message to send to the receiver
* @return none
*/
void CountryNetwork::transmitMsg(string receiver, string message)
{
}
/*
* Purpose: prints the current list nicely
* @param ptr head of list
*/
void CountryNetwork::printPath()
{
}
/*
* Purpose: reverse the entire network t
* @param ptr head of list
*/
void CountryNetwork::reverseEntireNetwork()
{
}
Background In the Lord of the Rings trilogy, there is a scene where a warning beacon is lit in the towers of Minas Tirith, which is seen by a second beacon, prompting them to light their own fire which a third beacon sees, and so forth. This was a rapid means of communication in the days before telegraphs were invented. In this assignment, you're going to simulate a communications network using a linked list. Each node in the list will represent a country and you need to be able to send a message between nodes from one side of the world to the other Building your own communications network You will be implementing a class to simulate a linear communication network between countries. There are three files in Moodle containing a code skeleton to get you started. Do not modify the header file or your code won't work in Moodle! You will have to complete both the class implementation in CountryNetwork.cpp and the driver file main.cpp. The linked-list itself will be implemented using the following struct (already included in the header file): struct Country string name; string message int numberMessages; // no. of messages passed through this country Country next; // name of the country // message this country has received // pointer to the next country l; void deleteEntireNetwork); If the list is empty, do nothing and return. Otherwise, delete every node in the linked list and set head to NULL. Print the name of each node as you are deleting it according to the following format: cout name B ->c-> D -> NULL", should yield "D- C-> B -> A-> NULL" with "D" as the new head void transmitMsg(string receiver, string msg); Traverse the linked list from the head to the node with name receiver. For each node irn this path (including the head), set the node's message to msg and increment the node's numberMessages field. If the list is empty, print "Empty list" and exit the function As you traverse the list, at each node report the message received and the number of messages received using the following cout: (See the end of this document for example output) cout name numberMessagesmessage If the network is empty then print "nothing in path
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
