Program that mimic operations of the inside of an elevator

Assignment Help JAVA Programming
Reference no: EM131832842

Assignment: Write an Algorithm/ flowchart and then convert it to a java program for given specifications/ requirements.

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.

a. Apply principles of abstraction and problem solving in an object-oriented programming language
b. Apply knowledge of programming constructs in developing computer programs
c. Create programs based on incremental development processes of designing, coding, testing and debugging.

Assignment Specification

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.

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.

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.

Reference no: EM131832842

Questions Cloud

Consider an urn that contains rm balls : A sampling (or coupon collecting) problem. Consider an urn that contains rM balls, for given integers rand M. Suppose that for each integer j, 1 to M
Create a surplus or a shortage in the labor market : Let's connect the minimum wage model back to the supply and demand model of Chapter 8. Is a minimum wage a price ceiling or a price floor?
Indistinguishable balls are distributed : If 7 indistinguishable balls are distributed among 10 urns in such a way that not more than 1 ball may be put in any urn and all such arrangements
Determine the structural or cyclical unemployment : Decide whether each of the following are frictional, structural, or cyclical unemployment: The economy gets worse, so General Motors shuts down a factory.
Program that mimic operations of the inside of an elevator : MN404 - Fundamentals of Operating Systems and Java Programming - Create programs based on incremental development processes of designing, coding, testing
What is the probability that a specified urn : If 10 distinguishable balls are distributed among 4 urns in such a way that all arrangements are equally likely, what is the probability that (i) a specified.
What is the current size of s : Suppose an initially empty stack S has performed a total of 25 push operations, 12 top operations and 10 pop operations. What is the current size of S?
Why do employment protection laws have negative effects : In France, why do employment protection laws tend to have negative effects on the young, already unemployed, and minority workers?
How many machines would it take to test out : What about all 10-atom molecules: How many years would it take for one machine to test all of these compounds at one per minute?

Reviews

len1832842

1/25/2018 6:33:19 AM

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 Generally relevant Algorithm devised (logic used) taking into considerations most of the end conditions. Flawless Code implemented. Some relevance in the algorithm and few conditions are considered. The logic used is not relevant. Demonstration Logic is clear and easy to follow with strong arguments Consistency logical and convincing Mostly consistent logical and convincing Adequate cohesion and conviction Argument is confused and disjointed

len1832842

1/25/2018 6:33:10 AM

Demonstration Tutor will see the outputs and also assess your understanding of work done for this assignment in the laboratory class. This will be done in Week-12 laboratory class . 10 Total 50 Grades Excellent Very Good Good Satisfactory Unsatisfactory 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 Generally relevant Algorithm devised (logic used) taking into considerations most of the end conditions. Flawless Code implemented. Some relevance in the algorithm and few conditions are considered. The logic used is not relevant.

len1832842

1/25/2018 6:33:02 AM

Marking criteria: Section to be included in the report Description of the section Marks Task 1 Algorithm Complete error-free program 10 10 Task 2 Algorithm Complete error-free program 10 10 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.

len1832842

1/25/2018 6:32:37 AM

Weight 20% of the total assessments Total Marks 50 Due Date Week 11 - Submission on lecture day Demonstration during laboratory class (week 12) Submission Guidelines • All work must be submitted on Moodle by the due date along with a completed Assignment Cover Page. • The assignment must be in MS Word format, 1.5 spacing, 11-pt Calibri (Body) font and 2 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

JAVA Programming Questions & Answers

  Create a program from scratch a one-dimensional game

create a program from scratch; a one-dimensional game of Lights Out. Briefly, the game consists of a row of lights that can be either on or off.

  Write an executable program with java

calculates the cost of the baggage when the weight of the baggage is stated by the operator. The baggage cost should differ from city to city

  Implement the methods in the myhashtable

Implement the methods in the MyHashTable - All methods of the Graph class are implemented for you - Implement the traverseFrom

  1obtaining the new script download and save the attached

1.obtaining the new script download and save the attached comment cgi mailer script form-mail.pl to your servers

  Small computer system interface-standard computer disk

How many primary drive partitions are supported on computers that still conform to the standard established by MS-DOS? How many total partitions can a standard computer disk [Intergrated Drive Electronics (IDE)/Serial Advanced Technology Attachment (..

  Manage the online course enrollments and grade recordings

Computer Science program to offer courses-Our focus in this project will be on developing a system to manage the online course enrollments and grade recordings

  Create abstract employee class and two pure virtual function

We are going to create an abstract Employee class and two pure virtual functions calculatePay() and displayEmployee(). The abstract Employee class will prevent a programmer from creating an object based on Employee

  Building your own er model editor

Take user input from GUI and normalize the relationship between entities - important components of ER-model Editor - ER-Diagram Editor and code generator. This would involve building our own ER model editor that would allow user to add their own SQL..

  Create system in java using agile approach

You are a software manager in company which designs critical control software for aircraft. Create system in Java using agile approach with a user involved in the development team.

  What is the standard error of the estimate

What is the Standard Error of the Estimate Sy/x?

  Prepare a java simulation program

Given a hash function h, prepare a java simulation program to determine each of the subsequent quantities after 0.8*tablesize random keys have been generated. The keys should be random integers.

  Display the properties of an arraylist object

Display the properties of an ArrayList object. The assignment is documented as attached. In 9-3.docx, #4-6 is what I am trying to complete

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