Develop financial projections for alternative solutions

Assignment Help Other Subject
Reference no: EM13326963

In a city there is an intersection where two (single lane) one-way streets cross each other. Write a C or C++ program that simulates the situation at this intersection and measures how long each queue gets during a 2 hour period. Adjust the phasing of the traffic lights to minimise the two queues that form at the intersection.

A sample program is available as a starting point for the assignment. It is able to receive two command line arguments, phase for Q1 and phase for Q2 (the equivalent of adjusting the phasing of the traffic lights for each intersection). During testing you can change the command line arguments approach, but for the final submission make sure that your code is working with it (open a cmd window and test it).

The intersections will be represented by two queues. The two queues need to be implemented using a dynamic data-structure, as the number of cars in each queue are unknown before the runtime.

Notes:

1. The program must contain two queues, each one based on a linked-list.

2. Write a new method (or function) to return the number of items (length) of the queue.

3. Each car is represented by an ID number - hence you need two queues of integers.

4. You need an integer counter (clock) to count the seconds from 0 to 7200 (2 hours), which is already implemented in the example.

5. This is an event driven program - the main program is a loop that increments the clock each time it executes.

6. Every 18 seconds a car joins queue 1 and every 22 seconds a car joins queue 2. This is fixed and should not be changed (in the example, represented by variables Q1arrive and Q2arrive).

7. Every 10 seconds a car leaves a queue and crosses the intersection (depending on which queue has the green light). This is also fixed, and is represented by variable leave_rate.

8. Phasing is the number of seconds that the light is green. Start your program with a phasing of 40 seconds for queue 1 and a phasing of 30 seconds for queue 2. For "technical reasons", phasing can never be set to less than 30 seconds. Again, in the example the variables are Q1phase and Q2phase.

9. Adjust the phasing to minimise the length of the queues. The current length of the queues are printed out for every second of the runtime. During the runtime, a queue of less than 5 cars is ideal but a queue of less than 9 cars is already acceptable. Try different phasing until you get acceptable queue sizes for both Q1 and Q2 (that's when arguments from command lines are useful).

10. After trying different phasing, write down as a comment on the top of the source code what was the best combination (phasing queue 1 = __ , phasing queue 2 = __).

Reference no: EM13326963

Questions Cloud

The market for a product is expected to increase : The market for a product is expected to increase at an annual rate of 8%. First year sales are estimated at $60,000, the horizon is 15 years, and the interest rate is 10%. What is the present value?
Why is market competition important is there a positive or : Why is market competition important? Is there a positive or negative impact on the economy when strong competitive pressures drive firms out of business? Why or why not?
What are the new lengths of the side of the plate : A square copper plate has a circular hole in its center. Each side of the plate is 23.52 cm, and the radius of the circular hole is 7.827 cm
Promote the destruction of cells with unrepaired dna : the normal function of p53 is to A) promote growth of tumor B) signal immune system cells that tumor cells are present C) promote the destruction of cells with unrepaired DNA replication errors
Develop financial projections for alternative solutions : The intersections will be represented by two queues. The two queues need to be implemented using a dynamic data-structure, as the number of cars in each queue are unknown before the runtime.
Explain the difference between accounting and economic proft : Explain the difference between accounting and economic profits.
How high above the ground level would the nail be : If a nail were driven into a tree at a height of five feet from ground level, and thereafter the tree grew an average of two feet in height per year, approximately how high above the ground level would the nail be ten years later
Determine the work done by the net force on the block : A block of mass 2.50 kg is pushed 3.00 m along a frictionless horizontal table by a constant 18.0 N force directed 25.0° below the horizontal. Determine the work done by the net force on the block
Find the speed of the block at the equilibrium point : A block with mass of 4.52 kg is attached to a horizontal spring with spring constant k = 3.59 102 N/m, Find the speed of the block at the equilibrium point

Reviews

Write a Review

Other Subject Questions & Answers

  The declaration of independence

The Declaration of Independence did all of the following except

  Researching doctrine of sovereign immunity

Prepare a summary of the doctrine and whether you feel it may affect your company's chances of successfully bringing suit against a foreign country.

  Schizophrenia and depression

Consider schizophrenia and major depression. Compare and contrast what is known (or at least hypothesized) about the following disease components. What is different and the same?

  Contemporary branches of judaism or islam

Pick one of the contemporary branches of Judaism or Islam and write a summary that: Identifies its origin.

  Contrast the psychological and sociological

Compare and contrast the Psychological and Sociological viewpoints Are the traditional methods of classifying a generation still meaningful in a diverse and changing nation?

  Strategic planning development-implementation process

The leader of the local health care organization, Ken Janowski, has noticed other health care organizations successfully incorporating strategic management practices. Ken is considering using strategic management for his health care organization.

  Current event or issue where governments interact

Provide an example of a current event or issue where multiple governments interact on the solution. Describe the ways that those government work together or against one another on the issue.

  Greatest percent of calories from fat

Which of the following contains the greatest percent of calories from fat (in a typical serving size)?

  Government into legislative-executive and judicial branches

What were the reasons our forefathers divided the government into the legislative, executive, and judicial branches? How are the three branches of U.S. Government supposed to interact? Is the system successful? Why or why not? Are the branches balanc..

  Example of when a penetration pricing strategy

Give an example of when a “penetration” pricing strategy would be in order.

  Discussuing the administrative laws

Explain the significance of this quote:"Thus the central function, and it is at the same time the central problem, of judicial review.

  Productivity or efficiency to the workplace

What are special characteristics, attitudes and talents you possess that add diversity to your workplace? Does American business recognizes that talents such as these add to productivity/efficiency to the workplace? How about where you work?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd