Question: Here is my code from befor: #include #include #include Packet.h using namespace std; class NetworkObject //beginning Network Object class definition { public: //Constructor NetworkObject(int objId):

 Here is my code from befor: #include #include #include "Packet.h" using

Here is my code from befor:

#include #include

#include "Packet.h" using namespace std;

class NetworkObject

//beginning Network Object class definition

{

public:

//Constructor

NetworkObject(int objId): packets(),objectId(objId){

//Parameterized constructor

NetworkObject();

//push packet into the queue that belong to one particular NetworkObject void setPacket(Packet *pckt) { packets.push(pckt); }

//pop packet one by one that belongs one particular NetworkObject Packet *popPacket() { Packet *pkt; pkt = packets.front(); packets.pop(); return pkt; }

//retrieve all the packets of a particular NetworkObject void getPacketInfo() { Packet *pkt; while(!packets.empty()) { pkt = popPacket(); cout

//returns objectId

int getObjectId(){

return objectId;

}

private:

//private member

int objectId; queue packets; //packets variable to store the packets in an queue };

//server class constructor is called from networkobject class parameterized constructor

class Server : public NetworkObject

{

public:

Server(int objId): NetworkObject(objId){}

};

int main()

{

//declare 6 NetworkObjects with id 4,8,16, 32, 64, 128.

NetworkObject at[6] = {{4}, {8}, {16}, {32}, {64}, {128}};

//Instantiate two objects of type Packet Packet *pckt1 = new Packet(8,4,"8 to 4"); Packet *pckt2 = new Packet(8,5,"8 to 5");

//push the above created packets in the queue at[1].setPacket(pckt1); at[1].setPacket(pckt2);

for(int i=0; i

{

//prints the object IDs of the network objects along with packet information

cout

}

Project 3 Due: April 22, 2018 at 11:55 PM This project concludes the network-oriented series that we began at the start of the semester. Its purpose is to act as a foundation to a simulation you can easily expand upon and add features to, while demonstrating a large number of the concepts we ve covered so far in the course FOR 50% EXTRA CREDIT ON THIS PROJECT: In the last lecture, we discussed the use of the averaging many random trials to determine the expected behavior of a system. In order to do this, we can sample the important variables of the system from a (often uniform) probability distribution for each computation. After each "run" of the system with random values, we can compute the results we're interested in and take an average. The average results we're interested in for the extra credit are 1. 2. Average percentage of packets lost. Average travel time of a packet. Regardless of whether or not you would like to do the extra credit, we'll want to generate the following variables randomly. Where they are generated should be fairly obvious based on what they do numberOfNodes: The number of nodes in the linked list (i.e. the number of network objects) probabilityOfPacketLoss: How often a node will drop a packet maxPackets: How many packets each NetworkObject can hold. This should be the size of your packets Queue. For simplicity, this value can apply to all NetworkObject nodes, rather than generating a different value for each node. For your own practice, you might try doing this anyway 1. 2. 3. For simplicity in this project, we will hold the packet source and target fixed at the beginning and end of the linked list. The modifications for this project can take place in main0 and whatever helper functions you see fit to create. However, the following additions must be made to the NetworkObject class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!