Apply knowledge of programming constructs

Assignment Help Computer Networking
Reference no: EM132371901

Assignment: To write an algorithm/ flowchart, and implement the algorithm using Python programming language for given

Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements in them:
c. Apply principles of abstraction and problem solving in an object- oriented programming language
d. Apply knowledge of programming constructs in developing computer programs
e. Create programs based on incremental development processes of designing, coding, testing and debugging.

Assignment Description

Task 1

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!

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 ==> 10 Going down..14..13..12..11..10..Ding!
Options: (s)elect a floor, (f)ire alarm, (q)uit Enter s, f, or q ==> f
Danger! You must exit the building now! Going down..9..8..7..6..5..4..3..2..1..Ding!
Options: (s)elect a floor, (f)ire alarm, (q)uit Enter s, f, or q ==> q

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:

T H E G A M E O F N I M

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

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? 2
The number of stones left is 1. The computer removes 1 stone. The number of stones left is 0. You win!
Do you want to play again? (y/n): n

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:

T H E G A M E O F N I M

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.

The number of stones left is 0. You win!
Do you want to play again? (y/n): n

Attachment:- Fundamentals of Operating Systems and Programming.rar

Reference no: EM132371901

Questions Cloud

Describe how to design a new product : 49989 - Operations Engineering - University of Technology Sydney - Develop a Design Review checklist consisting of minimum 25 questions distributed evenly over
Prepare a report or critique on an academic paper : Prepare a report or critique on an academic paper related to Enterprise application or designing or implementation challenges
Develop a conference management system : NIT5150 – Advanced Object Oriented Programming - Victoria University - What are the benefits of the system to the targeted organization/users
What type of organization structure would be of most value : Activity 1 - What type of organization structure would be of most value to this firm in its initial efforts to go international
Apply knowledge of programming constructs : MN404 - Fundamentals of Operating Systems and Programming - Melbourne Institute of Technology - Apply principles of abstraction and problem solving in an object
Determine a suitable promotional campaign strategy : Determine a suitable promotional campaign strategy for your chosen DMO or enterprise; provide a clear rationale based on academic sources.
Discuss company background and mission : BAVA320 Business Analysis and Valuation Assignment, Kent Institute Australia. Discuss Company background and mission
Future state of the internetworking infrastructure : Analyse and report on the current and future state of the internetworking infrastructure and its applications - Implement a process to support
Network architecture analysis and redesign : CSC81001 - Computer Networks - Network Management and Design - Southern Cross University - Simulate the network you have redesigned in eNSP and demonstrate

Reviews

len2371901

9/17/2019 1:41:15 AM

Grades Excellent Very Good Task - 1 Excellent Algorithm devised (logic used) taking into considerations all possible end conditions. Flawless Code implemented Relevant Algorithm devised (logic used) taking into considerations all possible end conditions. Flawless Code implemented Task - 2 Excellent Algorithm devised (logic used) taking into considerations all possible end conditions. Flawless Code implemented Relevant Algorithm devised (logic used) taking into considerations all possible end conditions. Flawless Code implemented Demonst ration Logic is clear and easy to follow with strong arguments Consistency logical and convincing

len2371901

9/17/2019 1:41:08 AM

Demonstration and Viva Tutor will see the outputs and assess your understanding of work done for this assignment in the laboratory class. Demonstration will be done in Week-12 laboratory class. 15 Total 55

len2371901

9/17/2019 1:41:02 AM

Section to be included in the report Description of the section Marks Task 1 Algorithm Complete error-free program 20 20 Task 2 Algorithm Complete error-free program 20 20 Following points to be considered: • Include import statement • Include a comment at the beginning of your program with basic information and a description of the program • Your code should be properly indented • Give meaningful names to variables and classes in your code. • Correct use of programming structures • Your program compiles successfully without any errors • Your program is interactive and gives correct output. • Provide snapshot of the Sample output along with the source code.

len2371901

9/17/2019 1:40:54 AM

Marking criteria: Students with MIT ID ending with even numbers have to do Task 1 and students with MIT ID ending with odd numbers have to do Task 2 as mentioned in the Table below: Students with ID ending with Task 0, 2, 4, 6, 8 1 1, 3, 5, 7, 9 2

len2371901

9/17/2019 1:40:43 AM

Due Date Week 10 laboratory class – To present the algorithm. Week 11 laboratory class – Demonstration of the assignment. Submission of final copy of the assignment. Submission Guidelines • All work must be submitted on Moodle by the due date along with a title Page. • The assignment must be in MS Word format, 1.5 spacing, 11-pt Calibri (Body) font and 2.54 cm margins on all four sides of your page with appropriate section headings. • Reference sources must be cited in the text of the report, and listed appropriately at the end in a reference list using IEEE referencing style.

Write a Review

Computer Networking Questions & Answers

  Describes the high-level user interaction with the program

You are designing a Windows-based, event-driven program to handle customers for a small business. You design the user interface with three screens.

  Explain briefly the purpose of the icmp protocol

MIS 3301 Assignment: Network Layer. Explain briefly the purpose of the ICMP protocol. At which layer the ICMP is located? What is the general structure of the ICMP packet? Explain each field in the ICMP header

  Create a logical campus network for slugworth candies

IT 1080C Computer Networking Final Project: Slugworth Candies, LLC - create a logical2 campus network for Slugworth Candies, LLC. Each local area network

  Search the web for security education and training program

Search the Web for security education and training program in your area. Keep a list and see which category has the most examples. See if you can determine the costs associated with example. Which do you think would be more cost-effective in terms of..

  Why is response time critical at the device level

At what level can COTS equipment be used in an industrial network? Which level of an industrial network is the most difficult to implement in Ethernet.

  Windows server 2012 - installation

Perform post-installation settings - Creating a Virtual Box Machine - Selecting the Windows 2012 type will default all the settings to the recommended

  Explain how you are learning subnetting

Talk about your efforts in the learning this important concept, and offer advice to your classmates on how you are learning subnetting.

  Register of the audible spectrum

A recording/playback system at 22,050 Hz would be missing most of the brilliance register of the audible spectrum

  Identify need or opportunity that prompted decision

Locate two such organizations. For each of the two, identify the need or opportunity that prompted the decision to have a physical presence.

  Cost and quality create a work breakdown structure wbs and

create a work breakdown structure wbs and assign resources and cost by using a project management tool. as the it

  How would you model something from your life now

What does modeling mean to you? How would you model something from your life now that you know about technology models?

  Plan for the development of an addressing and naming model

Include a cover page containing the title of the assignment, the student's name, the professor's name, the course title, and the date. The cover page and the reference page are not included in the required page length.

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