I need help, guys! Pls help me :(

closed account (Nvpjz8AR)
Here is the assignment I get:
*****
Write an email simulator that processes mail at an average of 40 messages per minute. As messages are received, they are placed in a queue.assume that the messages arrive at an average rate of 30 messages per minute.messages must arrive randomly.
Each minute, you can dequeue up to 40 messages and send them. Assume that 25% of the messages in the queue cannot be sent in any processing cycle.use a random number to determine whether a given message can be sent. If it can’t be sent, enqueue it.

Run the simulation for 24 hours, At the end of the simulation, print the statistics that show:

-The total messages processed.
-The average arrival rate.
-The average number of messages sent per minute.
-The average number of messages in queue in a minute.
-The number of messages sent on the first attempt, the number sent on the second attempt, and so forth.
-The average number of times messages had to be requeued (do not include the messages sent the first time in this average)

________________________________________________________________________________

Today I got this task for my assignment. So, I need help from you guys on this assignment because I'm a little bit beginner in this C++ programming field. Hope you all could help me :) Thank you
Last edited on
Stay tuned for several responses stating that this is not a homework site and you need to show your effort by posting your attempt and asking specific questions. Your assignment appears to be an intermediate task so if you can't even start it I suggest you re-take the course so you learn the basics.
closed account (Nvpjz8AR)
Well, actually I've done a part of the coding. But the thing is I don't have any idea how to continue it. I wish you could help me. Thanks cnoeval ! And here is my code :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
using namespace std;
#define SIZE 40

class Queue {
  int queue[SIZE];
  int head, tail;
public:
  Queue();
  void Enq(int num);
  void Dequeue();
  void Display();
};
Queue::Queue(){
  head = tail = 0;
}
void Queue::Enq(int num){
    int newtail = (tail+1)%SIZE;
    if(newtail!=head) //queue is'nt full
    {
        queue[tail]=num;
        tail=newtail;
    }
    else
    {
        cout<<"\n ***Queue is full***\n";
    }
}
void Queue::Dequeue(){
  if(head == tail) {
    cout << "Queue is empty\n";
  }
  head = (head+1) % SIZE;
}
void Queue::Display(){
    for(int i=head;i!=tail;i=(i+1)%SIZE)
    cout<<queue[i]<<" ";
    cout<<endl;
}
int main(){
    Queue EmailSim;




    return 0;
}
Last edited on
closed account (Nvpjz8AR)
Any idea guys ?
You've did that code, eh?

http://www.cplusplus.com/forum/general/51493/

Did you happen to do this same project 4 years ago?

If you are not going to do the code at least admit it and don't lie about creating something you obviously did not.
Topic archived. No new replies allowed.