Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ and data structure Dubai port is having trouble keeping up with the incoming cargo ship traffic. They have come up with a priority

using c++ and data structure

Dubai port is having trouble keeping up with the incoming cargo ship traffic.

They have come up with a priority system where ships would be allowed in the

port according to which one has the maximum priority as calculated by the

following formula:

priority=#containers * (1+days waiting)

The port is able to unload five ships per day.

Your task is to create a simulator of the port operation. Your program should

generate a given number of ships (as specified in the command line) each with

a random number of containers in the range of [100, 1000]. Your program

should then print out the order that these ships will come into the port, and the

min, max and average waiting time.

An example of how the program should be called:

$ portSim 10 // should simulate 10 ships

Order : 0 2 5 6 7 8 9 1 4 3

Min : 0

Max : 1

Average : 0.5

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

More Books

Students also viewed these Databases questions