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

Differences among risk assessment-public health assessment

Prepare a one page essay comparing and contrasting the differences among risk assessment, public health assessment, and ecological assessment. Include the 4 step risk assessme

Has your learning this week helped dispel assumptions

Do you hold, or have you held, assumptions about the elderly? Has your learning this week helped dispel assumptions? If so, which ones? Why is it vital to dispel such assump

What are the strengths of these special populations

What unique challenges do they face, separate from one another? What are the strengths of these special populations? What are the challenges these groups face with admitting

Role of ideology in policy making progress

Explain the role of ideology in the policy making process. Please give an example. What do you believe is or should be the major goal of the criminal justice system? Why?

Temp- to- perm position

Assume that you’re a prospective job seeker ( which you may very well be). What do you personally see as the advan-tages and disadvantages of taking a temp- to- perm position?

How did they act in order to try to create social change

What did they do, how did they act in order to try to create social change? What method or methods did they use? And in particular -- how did the media of their times affect

Aversion therapy utilizes conditioning treatment for alcohol

Aversion therapy utilizes conditioning as a treatment for alcohol and drug abuse. 1.) summarize the article, including the purpose of the study, outcome, and recommendations

Explain your rationale for the development of the campaign

Discuss why the campaign topic is relevant to a specific age and stage. Explain your rationale for the development of this campaign and why it is relevant to you as a professi

Reviews

Write a Review

 
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