Get 30% Off + $20 Signup Bonus ! Limited Time, Hurry !
Securing Higher Grades Costing Your Pocket?
Book Your Assignment at The Lowest Price
Now!
Students Who Viewed This Also Studied
MN404 Fundamentals of Operating Systems and Programming
Question:
Task I
Write an algorithm and a program that mimic the operations of the inside of an elevator. More specifically, the program simulates what happens when the user chooses to go to a particular floor, and it simulates what happens when the user pulls the elevator’s fire alarm. Assume the elevator is in a high-rise building that has floors numbered 1 through 100. Within your Elevator class, include these methods:
· SelectFloor ─ This method prompts the user for a floor selection and then performs input validation for the floor selection. If the floor selection is inappropriate (less than 1, greater than 100), then the method prints an error message. If the floor selection is OK, the method simulates going to that floor. See the sample session below for the format of the simulation message.
· FireAlarm ─ This method prints a “danger” message and then simulates going to the first floor. Note that I’m assuming this is a high tech fire alarm that is programmed to force the elevator to go to the first floor! See the sample session below for the format of the “danger” message. Within your ElevatorDriver class, use a loop that continues until the user enters “q” for quit. See the sample session for details.
Sample session:
Welcome to XXX’s (students name and ID) elevator simulator!
Options: (s)elect a floor, (f)ire alarm, (q)uit Enter s, f, or q ==> x Invalid selection.
Options: (s)elect a floor, (f)ire alarm, (q)uit Enter s, f, or q ==> F Danger! You must exit the building now!
Options: (s)elect a floor, (f)ire alarm, (q)uit Enter s, f, or q ==> s
Enter the floor that you’d like to go to ==> 102
Invalid floor selection – must be between 1 and 100.
Options: (s)elect a floor, (f)ire alarm, (q)uit
Enter s, f, or q ==> s Enter the floor that you’d like to go to ==> 15
Going up..2..3..4..5..6..7..8..9..10..11..12..13..14..15..Ding!
Task 2
Write an algorithm and a program that plays the ancient Chinese game of NIM. Actually, this is a simplified version of the game. Each game starts with a user-specified number of stones in a pile. The user and the computer take turns removing either one or two stones from the pile. The player who takes the last stone loses. Your program should have the computer use the optimal playing strategy. The optimal strategy is as follows: Divide the remaining number of stones by three. If the remainder is zero, then two stones are removed, or else one stone is removed.
For example, if the remaining number of stones is nine or fifteen, then two stones are removed; if the remaining number of stones is eight or ten, then one stone is removed. a) Your program should allow the user to play additional games of NIM as long as he/she enters a “y” or “yes” (lowercase or uppercase) in response to a “Do you want to play again?” prompt. See the sample session for required wording.
Sample session:
The Game of Nim
Enter number of starting stones: 7
Would you like to go first? (y/n): yEs
How many would you like to remove – 1 or 2? 1
The number of stones left is 6.
The computer removes 2 stones.
The number of stones left is 4.
How many would you like to remove – 1 or 2? 2
The number of stones left is 2.
The computer removes 1 stone.
The number of stones left is 1.
How many would you like to remove – 1 or 2? 1
The number of stones left is 0.
The computer wins!
Do you want to play again? (y/n): Y
Enter the number of starting stones: 4.
b) Add input validation to your Nim program. More specifically, (1) ask the user to re-enter the number of starting stones if he/she doesn’t enter a positive number, and (2) ask the user to re-enter the number of stones to be removed if he/she doesn’t enter an appropriate number.
Sample session:
The Game of Nim
Enter the number of starting stones: 7
Would you like to go first? (y/n): yEs
How many would you like to remove – 1 or 2? 1
The number of stones left is 6.
The computer removes 2 stones.
The number of stones left is 4.
How many would you like to remove – 1 or 2? 2
The number of stones left is 2.
The computer removes 1 stone.
The number of stones left is 1.
How many would you like to remove – 1 or 2? 2
You cannot remove 2 stones.
How many would you like to remove – 1 or 2? 1
The number of stones left is 0.
The computer wins! Do you want to play again? (y/n): Y
Enter the number of starting stones: 0 You cannot start with 0 stones.
Enter the number of starting stones: 4
Would you like to go first? (y/n): n
The computer removes 1 stone.
The number of stones left is 3.
How many would you like to remove – 1 or 2? 0
You cannot remove 0 stones.
How many would you like to remove – 1 or 2? 3
You cannot remove 3 stones.
How many would you like to remove – 1 or 2? 2
The number of stones left is 1.
The computer removes 1 stone.
MN404 Fundamentals of Operating Systems and Programming
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.
34 More Pages to Come in This Document. Get access to the complete answer.
More mn404 MN404 Fundamentals of Operating Systems and Programming: Questions & Answers
ICT301 Information Technology Project 1
Question:
Project Proposals
Project 2: Mobile application design and development for Contract and Commercial Resources Website: Contract and Commercial Resources, ccr.work
Brief Description: Proposing, designing and developing a mobile application for the company to show to its clients the …
View Answer
COMP1007 Programming Design
Question 1Your task is to design a Number converter in Pseudocode. The functionality shouldbe as follows:• Prompt the user with the options to select eitherBinary,Decimal,OctalorHexadecimal.• Prompt the user to enter in a “numeric-string”.(Alphanumeric in the case of Hex)• If the user …
View Answer
ITEC102 Python Fundamentals for Data Science
Tasks:
Task 1: Produce a summary statistics graph on current_weight, weight_a_year_ago, and height. Task 2 : Calculate correlation: Define weight_change = (current_weight – weight_a_year_ago). Calculate correlation between weight_change and the following variables, and determine whi …
View Answer
CN7023 Artificial Intelligence and Machine Vision
Question:
Task 1: Data Science Skills
Complete four MATLAB Online Courses to learn Data Science skills. Earn a certificate for each course, acquire four certificates to complete this part of the assessment. When completed, upload each certificate to Turnitin.
Course 1: MATLAB Onramp – Get sta …
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
Jennings Dyer
financial advisor at a leading Multinational company based in USA.
800 – Completed Orders
Hire Me
Still in Two Minds? The Proof is in Numbers!
38983 Genuine Reviews With a Rating of 4.9/5.
English
Essay: 5 Pages, Deadline:
1 day
Great work thank you very much. Strongly recommended and will definitely ask for my future assignemnts
User ID: 5***63 Canada
Pharmacy
Essay: 2 Pages, Deadline:
19 days
very fast, easy to communicate with, clear and easy to understand the assigment when reviewed appreciate
User ID: 7***34 Saudi Arabia
Finance
Programming: 14 Pages, Deadline:
2 days
the assignment was done well,i appreciate it.the expert was patience and i think understood the assignment he did a great work there,i would have lov …
User ID: 8***11 United Kingdom, Great Britain
Assignment
Essay: 1.6 Pages, Deadline:
6 days
Thanks for the quick re-work on my assignment. Minor edits were perfectly done with the supplied feedback. Although the work hasn’t been graded yet …
User ID: 4***8 Durham, Great Britain
Management
Assignment: 20 Pages, Deadline:
13 days
Thank you team, well done everything, nice work , and appreciate what you did. Next assignment fir sure via myassignmenthelp.com
User ID: 7***18 Dubai, United Arab Emirates
Management
Programming: 18 Pages, Deadline:
13 days
Well done team, thank you for the support I appreciate your hard work Sure as always next order will send via you
User ID: 7***18 Dubai, United Arab Emirates
Assignment
Assignment: 1 Page, Deadline:
2 days
Thanks I got good grade which is good enough for me to pass the course Thanks again
User ID: 7***41 Dubai, Canada
Psychology
Assignment: 9 Pages, Deadline:
9 days
great assignment and thanks to the team as they have done what i have asked them thanks again
User ID: 2***88 Fairfield, Australia
Assignment
Essay: 2.8 Pages, Deadline:
1 day
Soo, good. relly satisfied. thank you so much. I received it earlier than my due date time, and the writer did a really great job.
User ID: 6***39 Fairfield, United States
Economics
Home Work: 2 Pages, Deadline:
1 day
Wonderful guys.. I got a A+ Thanks for going the extra mile to ensure there were no plagirarism.
User ID: 8***17 Kingston, Jamaica
Assignment
Assignment: 2 Pages, Deadline:
3 days
It’s good article, and I hope another time focus about the grammar. But finally it is great article
User ID: 1***67 Westlake, United States
Biology
Programming: 2.4 Pages, Deadline:
4 days
Good service; assignment was competed as per requirements and within the due date/time. Would use again. Prompt feedback response etc.
User ID: 2***50 Kitchener, Canada
Project Management
Assignment: 36 Pages, Deadline:
3 days
the work done by expert on Consultancy project was very good I have perused 60 marks in overall consultancy project.
User ID: 1***25 Leicester, Great Britain
Supply Chain
Home Work: 1 Page, Deadline:
13 days
Live support chat is always available . I received all assignments on given time .According to my previous corsework was given a score 80 out of 100. …
User ID: 8***97 Erbil, Albania
Criminal Law
Home Work: 8 Pages, Deadline:
5 days
first of all i would to say you id a great job by trying to make it look like its easy
User ID: 6***92 Brisbane, Australia
Management
Essay: 4 Pages, Deadline:
4 days
Great write up. Lecturer commented that it is good and great analysis has been carried out.
User ID: 8***83 Brisbane, Malaysia
Assignment
Essay: 8 Pages, Deadline:
4 days
Many mistakes in this essay. I can email you copy in which my tutor give to much bad comments and highlights the mistakes
User ID: 7***60 Sydney, Australia
Management
Essay: 1.2 Pages, Deadline:
1 day
The essay was well-written and on-time delivered. Pretty impressed with professionalism
User ID: 8***78 Sydney, Singapore
Assignment
Essay: 2 Pages, Deadline:
2 days
I’m pleased with the way and manner how my assignment was answered, I am very satisfied with it and thanks for doing a great job.
User ID: 7***58 Sydney, Australia
Finance
Course Work: 4.8 Pages, Deadline:
13 days
this assignment was very well done. scored a solid 85 which is ok. Would recommend to anyone.
User ID: 5***64 Sydney, Saint LUCIA
English
Essay: 5 Pages, Deadline:
1 day
Great work thank you very much. Strongly recommended and will definitely ask for my future assignemnts
User ID: 5***63 Canada
Pharmacy
Essay: 2 Pages, Deadline:
19 days
very fast, easy to communicate with, clear and easy to understand the assigment when reviewed appreciate
User ID: 7***34 Saudi Arabia
Finance
Programming: 14 Pages, Deadline:
2 days
the assignment was done well,i appreciate it.the expert was patience and i think understood the assignment he did a great work there,i would have lov …
User ID: 8***11 United Kingdom, Great Britain
Assignment
Essay: 1.6 Pages, Deadline:
6 days
Thanks for the quick re-work on my assignment. Minor edits were perfectly done with the supplied feedback. Although the work hasn’t been graded yet …
User ID: 4***8 Durham, Great Britain
Management
Assignment: 20 Pages, Deadline:
13 days
Thank you team, well done everything, nice work , and appreciate what you did. Next assignment fir sure via myassignmenthelp.com
User ID: 7***18 Dubai, United Arab Emirates
Management
Programming: 18 Pages, Deadline:
13 days
Well done team, thank you for the support I appreciate your hard work Sure as always next order will send via you
User ID: 7***18 Dubai, United Arab Emirates
Assignment
Assignment: 1 Page, Deadline:
2 days
Thanks I got good grade which is good enough for me to pass the course Thanks again
User ID: 7***41 Dubai, Canada
Psychology
Assignment: 9 Pages, Deadline:
9 days
great assignment and thanks to the team as they have done what i have asked them thanks again
User ID: 2***88 Fairfield, Australia
Assignment
Essay: 2.8 Pages, Deadline:
1 day
Soo, good. relly satisfied. thank you so much. I received it earlier than my due date time, and the writer did a really great job.
User ID: 6***39 Fairfield, United States
Economics
Home Work: 2 Pages, Deadline:
1 day
Wonderful guys.. I got a A+ Thanks for going the extra mile to ensure there were no plagirarism.
User ID: 8***17 Kingston, Jamaica
Assignment
Assignment: 2 Pages, Deadline:
3 days
It’s good article, and I hope another time focus about the grammar. But finally it is great article
User ID: 1***67 Westlake, United States
Biology
Programming: 2.4 Pages, Deadline:
4 days
Good service; assignment was competed as per requirements and within the due date/time. Would use again. Prompt feedback response etc.
User ID: 2***50 Kitchener, Canada
Project Management
Assignment: 36 Pages, Deadline:
3 days
the work done by expert on Consultancy project was very good I have perused 60 marks in overall consultancy project.
User ID: 1***25 Leicester, Great Britain
Supply Chain
Home Work: 1 Page, Deadline:
13 days
Live support chat is always available . I received all assignments on given time .According to my previous corsework was given a score 80 out of 100. …
User ID: 8***97 Erbil, Albania
Criminal Law
Home Work: 8 Pages, Deadline:
5 days
first of all i would to say you id a great job by trying to make it look like its easy
User ID: 6***92 Brisbane, Australia
Management
Essay: 4 Pages, Deadline:
4 days
Great write up. Lecturer commented that it is good and great analysis has been carried out.
User ID: 8***83 Brisbane, Malaysia
Assignment
Essay: 8 Pages, Deadline:
4 days
Many mistakes in this essay. I can email you copy in which my tutor give to much bad comments and highlights the mistakes
User ID: 7***60 Sydney, Australia
Management
Essay: 1.2 Pages, Deadline:
1 day
The essay was well-written and on-time delivered. Pretty impressed with professionalism
User ID: 8***78 Sydney, Singapore
Assignment
Essay: 2 Pages, Deadline:
2 days
I’m pleased with the way and manner how my assignment was answered, I am very satisfied with it and thanks for doing a great job.
User ID: 7***58 Sydney, Australia
Finance
Course Work: 4.8 Pages, Deadline:
13 days
this assignment was very well done. scored a solid 85 which is ok. Would recommend to anyone.
User ID: 5***64 Sydney, Saint LUCIA
Have any Query?
The post MN404 Operating Systems and Programming:Algorithm using Python Programming appeared first on My Blog.