$20 Bonus + 25% OFF
Securing Higher Grades Costing Your Pocket?
Book Your Assignment at The Lowest Price
Now!
Students Who Viewed This Also Studied
COMP2140 Data Structures And Algorithms
Question:
Instructions
*You must complete the “Honesty Declaration” checklist on the course website before you can submit any assignment.
*Assignments must follow the programming standards document published on UM Learn.
*After the due date and time, assignments may be submitted, but will be subject to a late penalty. Please see the course outline document published on UM Learn for the course policy for late submissions.
*If you make multiple submissions, only the most recent version (the last submission) will be marked. We strongly encourage you to submit early!
*These assignments are your chance to learn the material for the exams. Code your assignments independently. We use software to compare all submitted assignments to each other, and pursue academic dishonesty vigorously.
*You can get help from the T.A. during your lab section and from the instructors and from the course Assignment 5 discussion forum on UM Learn. You can discuss general topics related to the assignment with fellow students or other people, but you cannot discuss the solution to the assignment with them.
*You cannot copy code from anywhere except COMP 2140 class notes, unless we tell you otherwise. For a full discussion of our expectations for individual work on this assignment, see the Department of Computer Science’s expectations webpage.
*Your Java program must compile and run upon download, without requiring any modifications. The marker will not fix your program’s problems.
Part 1 (Programming): Waiting to See a Doctor at an ER
Objective: To simulate patients in an Emergency Room (ER) waiting room.
The application and the file you will complete: The file A05.java contains an incomplete application that simulates patients arriving at and leaving an ER.
The application creates a priority queue to represent the waiting room of the ER for a hospital. Then it randomly generates some events:
*A new patient arrives at the ER. The triage nurse assigns the new patient the next available patient ID and an appropriate priority (based on the patient’s complaint and condition). The patient then waits in the waiting room.
*The highest-priority patient leaves the waiting room to see a doctor.
*A patient leaves the hospital without seeing a doctor.
*A patient’s condition changes, so the triage nurse changes the patient’s priority.
After all the randomly-generated events have been handled, the application prints out some statistics.
Representing a patient and the waiting room: A patient is represented by a Patient object, which contains a patient ID and a priority (both ints). You can get the ID or the priority, and you can change a priority.
The waiting room is represented by a TriagePriorityQueue, which is implemented as a max heap with all the usual methods, plus some non-standard methods. The heap array in this implementation is an array of Patient objects.
The TriagePriorityQueue methods you will write: You will write the bodies of two non-standard methods in TriagePriorityQueue to complete the application. Do not change anything else in the file.
*Method isHeapOrdered needs to return true if the calling TriagePriorityQueue array is in heap order and false if it isn’t. It has to check that every parent is in heap order with respect to its children (or child, if it only has one).
*Method changePriority is passed the ID number of a patient in the waiting room and a new priority for that patient. This method has two parts: a non-standard part (finding the patient with the given ID in the heap in a linear search and changing that patient’s priority to the new priority) and a standard part (restoring heap order). Hint: Use already-written helper methods to find the patient and to restore heap order — you just have to figure out when and how to call them.
In both these method bodies, if there is already a TriagePriorityQueue method to do something you need to do, then you should use the existing method. So look at the existing methods and do not duplicate code!
COMP2140 Data Structures And Algorithms
Answer in Detail
Solved by qualified expert
Get Access to This Answer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
51 More Pages to Come in This Document. Get access to the complete answer.
More COMP2140 COMP2140 Data Structures And Algorithms: Questions & Answers
Business Management
Task is to develop a formal specification in Z for the following proposed system: Wheat Truck Control System (WTC) …
View Answer
COE691 Software Requirements
Develop 16strategies illustrating the impact of allcombinations of alternatives (use 100 for a selected option, and 0 for unselectedin your initializations). Make sure to use jUCMNav’s [0..100] scalefor the analysis(once you have created a model, right-click on URNspec in the Outline view, and …
View Answer
Information Technology
Write a program using the above conventions that will read the metadata from such a file. Your program should output the data into two files. One binary file and one text file. Obviously the binary file will contain data encoded as binary and the text file will contain data encoded as text. In the b …
View Answer
Data Structures and Algorithms in Python
Data structures and algorithms in python, creating a program which implements algorithms manually to display data pulled from the web. …
View Answer
Content Removal Request
If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the
content removal request.
Choose Our Best Expert to Help You
Malachi House
Master’s degree in Computer Science and Engineering from California Institute of Technology.
900 – Completed Orders
Hire Me
Amrin Fong
Pursuing PhD in Marketing with Specialization in E-Commerce
2789 – Completed Orders
Hire Me
Still in Two Minds? The Proof is in Numbers!
33845 Genuine Reviews With a Rating of 4.9/5.
Economics
Home Work: 3500 Pages, Deadline:
3 days
well written, i scored well in exam, thanks to the expert who answered all my questions on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Home Work: 12 Pages, Deadline:
5 days
thanks for your support. very well written and answered all questions but some answers were submit late so i didnt upload
User ID: 7***15 Adelaide, Ecuador
Accounting
Assignment: 7 Pages, Deadline:
2 days
very well written, answered all questions correctly and submited on time, the management is really good
User ID: 7***15 Adelaide, Ecuador
Finance
Course Work: 7 Pages, Deadline:
4 days
very well writen and answered all questiones, the graphs and answers are all correct. submited on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Essay: 4 Pages, Deadline:
23 hours
well written, good referencing, submited on time, very reliable and less plagrism, i manage to score grade C
User ID: 7***15 Adelaide, Ecuador
Maths
Home Work: 1 Page, Deadline:
4 days
Great work, got a good grade on this assignment. I am very happy with the end result, thank you.
User ID: 4***77 United States
Mechanical Engineering
Home Work: 2 Pages, Deadline:
5 days
Good work and effort with this quick turnover assistant . Will use them again next time
User ID: 7***81 Perth, Australia
Civil Law
Essay: 2.4 Pages, Deadline:
10 hours
Thank you very much. I have an A. I will highly recommend your service to my friends. Your work is excellent, and your service is trustworthy.
User ID: 8***80 United States
Marketing
Assignment: 2 Pages, Deadline:
3 days
Thank you everything looks amazing. I will let you know what grade I get. Thanks so much
User ID: 6***39 Round Rock, United States
Civil Engineering
Programming: 2 Pages, Deadline:
4 days
Absolutely Awesome!!! This was done perfectly and tutor very easy to work with. Thank you so much
User ID: 6***39 Round Rock, United States
Economics
Home Work: 3500 Pages, Deadline:
3 days
well written, i scored well in exam, thanks to the expert who answered all my questions on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Home Work: 12 Pages, Deadline:
5 days
thanks for your support. very well written and answered all questions but some answers were submit late so i didnt upload
User ID: 7***15 Adelaide, Ecuador
Accounting
Assignment: 7 Pages, Deadline:
2 days
very well written, answered all questions correctly and submited on time, the management is really good
User ID: 7***15 Adelaide, Ecuador
Finance
Course Work: 7 Pages, Deadline:
4 days
very well writen and answered all questiones, the graphs and answers are all correct. submited on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Essay: 4 Pages, Deadline:
23 hours
well written, good referencing, submited on time, very reliable and less plagrism, i manage to score grade C
User ID: 7***15 Adelaide, Ecuador
Maths
Home Work: 1 Page, Deadline:
4 days
Great work, got a good grade on this assignment. I am very happy with the end result, thank you.
User ID: 4***77 United States
Mechanical Engineering
Home Work: 2 Pages, Deadline:
5 days
Good work and effort with this quick turnover assistant . Will use them again next time
User ID: 7***81 Perth, Australia
Civil Law
Essay: 2.4 Pages, Deadline:
10 hours
Thank you very much. I have an A. I will highly recommend your service to my friends. Your work is excellent, and your service is trustworthy.
User ID: 8***80 United States
Marketing
Assignment: 2 Pages, Deadline:
3 days
Thank you everything looks amazing. I will let you know what grade I get. Thanks so much
User ID: 6***39 Round Rock, United States
Civil Engineering
Programming: 2 Pages, Deadline:
4 days
Absolutely Awesome!!! This was done perfectly and tutor very easy to work with. Thank you so much
User ID: 6***39 Round Rock, United States