Prepare a demo program

Assignment Help JAVA Programming
Reference no: EM13694861

Question: Specify, design, and implement a class that will be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 39 marked on the edge, and it has a three-number combination, which we will call x,y,z.

In order to open the lock, you must turn the knob clockwise at least one whole revolution, stopping with x at the top; then you turn the knob counterclockwise, stopping the "second" time that y appears at the top; finally, you turn the knob clockwise again, stopping the next time that z appears at the top. At this point, you may open the lock.

Your "Lock" class should have a constructor that initializes the three-number combination (use 0,0,0 for default arguments in default constructor)

Also, provide the subsequent methods:

a) To alter the lock's combination to a new 3-number combination

b) To turn the knob in a given direction until a specified number appears at the top. (You also must show all of the numbers in the output as the lock is being turned - could use a for loop)

c) To close the lock

d) To attempt to open the lock

e) To inquire about the status of the lock (open or closed)

f) To tell what number is currently at the top.

Prepare a demo program that uses all of the above methods.

It must compile with no errors and follow the directions and you have to satisfy the requirements specific in the instruction.

Reference no: EM13694861

Questions Cloud

Find where would a charge need to be located : A +10nC charge is located at (x,y)=(0cm, 11cm ) and a -3.0nC charge is located (x,y)=(6.0cm ,0cm). Where would a -15nC charge need to be located in order that the electric field at the origin be zero
Find the hall voltage developed : A rectangular copper strip 1.0 cm wide and 0.1cm thick carries a current of 5.0A. Find the Hall voltage developed when a magnetic field of 1.5T is applied perpendicular to the strip
Find the wavelength of the wave in vacuum : A 1.90 x 1014 Hz electromagnetic wave propagates in carbon tetrachloride with a speed of 2.05 x 108 m/s. Find the wavelength of the wave in vacuum
Compute the speed of the block : 1.0•kg block is tied to a string that is wrapped around the rim of a pulley of radius 10•cm. Find the speed of the block after it has fallen through a height of 0.48•m
Prepare a demo program : Design, and implement a class that will be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 39 marked on the edge, and it has a three-number combination, which we will call x,y,z.
What is the kinetic energy of the earth rotational motion : What is the kinetic energy of the Earth's rotational (spin) motion
Find the ph during the titration of triethylmine : Problem- Find the pH during the titration of 20.00mL of 0.1000M triethylmine, Kb=5.2x10^-4, with 0.1000M HCl solution after the following additions of titrant. a) 13.00mL b) 20.60mL c)26.00ml
Which mass has more kinetic energy : In an explosion, an object breaks down into two pieces, M1 and M2. M2 flies away at 3 times the speed of M1. Which mass has more kinetic energy
Definition of big-o : Use the definition of big-O to prove that 3n+2logn = O(n) - Please show me all the working and provide the answer and provide the proper C & K Constants.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Application for an animal-fur trimming service

Create an application for an animal-fur trimming service. Write the code for the application. Prompt the user to indicate how many animals. Display the total fee for one year. Be pleasant in your output as it will be expensive.

  We will simulate a very simple network by having a process

we will simulate a very simple network by having a process correspond to a node in the network and files correspond to

  Write java code to read integers from an input file

write java code to read integers from an input file and write only the odd numbers to an output file. the two file names will be provided on the command line as the input file followed by the output file.

  Report the last letter of each word in the string

Write a sequence of Java statements that report the last letter of each word in the string.

  Write a java program that asks the user for his/her gender

According to researchers at Stanford Medical School, the ideal weight for a woman is found by multiplying her height in inches by 3.5 and subtracting 108.

  Your letterinventory class must use an array

Your LetterInventory class must use an array of Counter objects. Note that there is no nextChar method in the Scanner class. You must use the next() method and then use a loop through the characters of the token that is returned. Ignore any character..

  Implement security so that all users can view the informatio

Implement security so that all users can view the information about the projects, but only authenticated users

  Determine if strings are equal

Complete the recursive method match in the code below which will determine whether or not two strings match.

  Design and implement a small and simple email server using

design and implement a small and simple email server using the concept of web based information system wbis. your

  Program that uses random instead of scanner to play

Write a Java Program that uses Random instead of Scanner to play many rounds of Rock Paper Scissors. The user and computer will each randomly pick one and common rules of winning apply

  Create a temperature sensor simulator

create a temperature sensor simulator. First, display a menu that will ask the user what season to simulate (1) winter (2) spring (3) summer (4) fall or (5) to exit. Once the use selects the season your program should ask the user how many simulation..

  Write a method called hash midpoint

Write a method called hasMidpoint that accepts three integers as parameters and returns 'true' if one of the integers is the midpoint between the other two integers; that is to is if one integer is exactly between the two others. The method should re..

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