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

  Determine herzberg-s motivation factors for general managers

Determine Herzberg's motivation factors are Trust and Lichman emphasizing for general manages? Would it be possible for Finagle A bagel to apply concept of flextime to store employees?

  The united states participation in nato

The united states' participation in NATo

  All kids experience separation anxiety

All kids experience separation anxiety. but when does separation anxiety typically appear

  How regional metamorphism is related to plate boundaries

Briefly outline how regional metamorphism is related to plate boundaries? Are certain types of metamorphic rocks indicative of particular plate boundaries or tectonic settings?

  Memory-free recall-cued recall-recognition memory

Please give examples, preferably from your own life experience. How is the concept of mnemonics used in learning material?

  The belief that abnormal behavior

The belief that abnormal behavior results primarily form inappropriate learning represents which approach?

  Systems-cybernetic perspective

Compare and contrast the issue of presenting problems from an individual psychology perspective and from a Systems-Cybernetic perspective.

  Explain treatment for symptoms or intervention-precipitation

Explain precipitation situation. What occurred? How did you or they react? What particular symptoms did you or other person experience?

  Miniature replicas

“Miniature replicas” are: Subsidiaries structured to mirror that of domestic organizations Small scale reproduction of each firm to show at office meetings Company created to make miniature building Foreign company purchased to create a multinational..

  Explain specific kinds relationship

Write down 350- to 700-word response summarizing three dimensions of love and how they interrelate to recognizing specific kind of love relationship.

  Jefferson’s views on republican virtue

Jefferson’s views on republican virtue and why did he favor an agrarian society over an industrial one and a well-educated citizenry over an ill-informed one?

  Tree diagramming

Draw complete tree diagrams showing form and function of the different sentences in the following excerpts with particular focus on the verb phrase.

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