in C  Write aprogram that simulates multiple contractors who are making bids to contracts with the city council.In the simulation, there are at least four bidderswho bid based on the pricing below: Bidders 1 & 2 bid lower prices based on a uniform value from the range [1-7], inclusive. •The last two bidders bid higher prices based on a uniform value from the range [3-10], inclusive. •All other biddersbid prices based ona uniform value in the range [1-10], inclusive.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

in C 

Write aprogram that simulates multiple contractors who are making bids to contracts with the city council.In the simulation, there are at least four bidderswho bid based on the pricing below:

Bidders 1 & 2 bid lower prices based on a uniform value from the range [1-7], inclusive.

•The last two bidders bid higher prices based on a uniform value from the range [3-10], inclusive.

•All other biddersbid prices based ona uniform value in the range [1-10], inclusive.

 

No. Bidders: 10
No. Bids: 1000000
BIDDER
WINS
PERCENT.
1
163052
16.31%
163389
16.34%
108534
10.85%
107907
10.79%
10.79%
10.89%
4
107862
108927
108593
10.86%
108190
10.82%
11684
1.17%
10
11862
1.19%
The average price is 1.56
Your code should have the following functions.
get_bids: This function takes the bids array and its size (number of bidders) as parameters and
fills all the bids of one round based on the pricings above. This function is called once for each
round of bidding.
get_lowest_bid: This function takes the bids array and its size as parameters and returns the
lowest bid.
get_winner: This function takes the bids array, its size and the lowest bid (already computed by
the previous function) and returns the winner. In case multiple bidders have bid the lowest price,
the function must choose between them randomly based on the rand() function. The function
should not always pick the first such bidder (or the last such bidder). E.g., if Bidders 2,3 and 7
have bid the lowest price, the function can't just pick 2 since it's the first one. The function must
use the rand() function to generate a random number out of 3 values (0,1,2) and based on it pick
(2,3,7), respectively.
print_results: This function takes the wins aray (which tracks the number of wins for every
bidder), its size and the total number of bids that took place and prints the output shown in the
sample above.
All the arrays are declared in the main function. There should be no global arrays. The main has a loop
that calls all the functions and updates the arrays. The result printing function is called once at the end of
the main function.
Transcribed Image Text:No. Bidders: 10 No. Bids: 1000000 BIDDER WINS PERCENT. 1 163052 16.31% 163389 16.34% 108534 10.85% 107907 10.79% 10.79% 10.89% 4 107862 108927 108593 10.86% 108190 10.82% 11684 1.17% 10 11862 1.19% The average price is 1.56 Your code should have the following functions. get_bids: This function takes the bids array and its size (number of bidders) as parameters and fills all the bids of one round based on the pricings above. This function is called once for each round of bidding. get_lowest_bid: This function takes the bids array and its size as parameters and returns the lowest bid. get_winner: This function takes the bids array, its size and the lowest bid (already computed by the previous function) and returns the winner. In case multiple bidders have bid the lowest price, the function must choose between them randomly based on the rand() function. The function should not always pick the first such bidder (or the last such bidder). E.g., if Bidders 2,3 and 7 have bid the lowest price, the function can't just pick 2 since it's the first one. The function must use the rand() function to generate a random number out of 3 values (0,1,2) and based on it pick (2,3,7), respectively. print_results: This function takes the wins aray (which tracks the number of wins for every bidder), its size and the total number of bids that took place and prints the output shown in the sample above. All the arrays are declared in the main function. There should be no global arrays. The main has a loop that calls all the functions and updates the arrays. The result printing function is called once at the end of the main function.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY