Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am writing this program in C++. Here is part of the description of the assignment. I have to use a Linked List to implement

I am writing this program in C++. Here is part of the description of the assignment. I have to use a Linked List to implement this line of customers in an office. I have successfully implemented my link list. But I cannot figure out the logic of dealing with customers. See the image below. I only need help with the "main" function. The program is supposed to do this as well: Print a running log with a line detailing every time a client comes in the door or makes a phone call or has finally gotten her question answered. Each line should indicate the time the event happened, to whom it happened (number each client from 1 to however high they reach), and how long the line in the office is after the event. (The client currently being served counts as a member of the line, as do waiting phone callers.)

Any help or hints would be helpful.

image text in transcribed

1. The problem A (male) secretary helps a stream of (female) clients who enter his office. When someone comes in, she wants to ask a question that will take the secretary q seconds to answer. She waits in line until it is her tun. Every d seconds, someone else comes in through the door to ask something and waits in line until she is at the front However, some clients are clever, and instead of going to the secretary's office, they call him on the telephone. Phone clients occur every p seconds. The secretary is so flustered by phone calls that he interrupts his answer to the current client (whether the current client is physically in his office or is another phone-in client) and makes her wait at the front of the line. He then considers the client on the phone as if she were at the front of the line. When he eventually gets back to a waiting client, he must devote whatever time she is still owed to finish answering her question. 2. What to do Write a program that simulates this office. Instead of fixed values for q, d, and p, use a uniformly-distributed random real number between 0 and q. 0 and d, and 0 and p, respectively. To get a uniformly- distributed random real number between 0 and x, you may use the C library random() routine

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

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

How we can improve our listening skills?

Answered: 1 week ago

Question

How do artifacts affect interaction between members of the team?

Answered: 1 week ago