Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: Answer by C Language The Harvest Jazz & Blues organizers have asked that you model their ticket sales. For a given show there are

Note: Answer by C Language

image text in transcribed

image text in transcribed

The Harvest Jazz & Blues organizers have asked that you model their ticket sales. For a given show there are only so many tickets available to be sold. Ticket sellers come to the main office and take a number of tickets they are about to sell to a customer. You are asked to write a pthreadsprogramto- model the tickets being sold. To make the programming easier we are allowed to make the following simple assumptions 5. When the program starts we are given the total number of tickets for the show There are 10 ticket sellers. Each ticket seller will: o Choose a random number of tickets they wish to get from the main office for the customer. You can call the function random tickets() to get this number o Obtain the tickets from the main office supply of tickets available. o After selling some tickets they will go to sleep for a random amount of time waiting for the next customer. You can do this by calling the sleep random() function given below .Each seller continues selling tickets until no tickets remain to be sold. In the event a customer requests more tickets than are available, the customer gets no tickets and leaves At the end of the program each ticket seller is to report the number of tickets that they sold for the show /Function to decide th umber of tickets a customer wants from1 to 10 / int random_tickets() return (rand() 10 + 1); /*Function to sleep for a random interval from 1 to 10 seconds void sleep_random() 10 1); The Harvest Jazz & Blues organizers have asked that you model their ticket sales. For a given show there are only so many tickets available to be sold. Ticket sellers come to the main office and take a number of tickets they are about to sell to a customer. You are asked to write a pthreadsprogramto- model the tickets being sold. To make the programming easier we are allowed to make the following simple assumptions 5. When the program starts we are given the total number of tickets for the show There are 10 ticket sellers. Each ticket seller will: o Choose a random number of tickets they wish to get from the main office for the customer. You can call the function random tickets() to get this number o Obtain the tickets from the main office supply of tickets available. o After selling some tickets they will go to sleep for a random amount of time waiting for the next customer. You can do this by calling the sleep random() function given below .Each seller continues selling tickets until no tickets remain to be sold. In the event a customer requests more tickets than are available, the customer gets no tickets and leaves At the end of the program each ticket seller is to report the number of tickets that they sold for the show /Function to decide th umber of tickets a customer wants from1 to 10 / int random_tickets() return (rand() 10 + 1); /*Function to sleep for a random interval from 1 to 10 seconds void sleep_random() 10 1)

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

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

=+ What is their expected negotiating style?

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago