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

  Design a class named large integers

Design a class named largeIntegers such that an object of this class can store an integer of any number of digits.

  Create a file that contains your favorite movie quote

Create a file that contains your favorite movie quote. Use a text editor such as Notepad, and save the file as quote.txt. Copy the file contents,

  Discuss the legal ramifications of the division of condo

Discuss the legal ramifications of the division of condo, BioTech and other assets. Would it make any difference if Violet sold the property after filing for the dissolution of marriage?

  Objectivesbullto exercise the analysis design and

objectivesbullto exercise the analysis design and implementation activities of software development.bullto learn

  Project socket programming - udp objectives - learn socket

project socket programming - udp objectives - learn socket programming in java udp-nbsp cement your understanding of

  Describe the basic c syntax for creating a class comprise

explain the basic c syntax for creating a class. include an explanation of the private and public section of a class

  Write a complete program which computes the sum

Write a complete program (actually complete the one on the exam) which computes the following sum: ( 100 / 1 ) + ( 99 / 2 ) + ( 98 / 3 ) + ( 97 / 4 ) + ... + ( 3 / 98 ) + ( 2 / 99 ) + ( 1 / 100 ) Use a FOR loop in your program (where indicated) to..

  Write an expression those results in a string consisting

Write an expression those results in a string consisting of the third through tenth characters of the strings. Make this program using java programming.

  Structure named dog with a string field

Create a Structure named dog with a string field for the Dog's name. Create a Structure named Cat with a string field for the Cat's name. Write a program that declares one Dog and one Cat, and assign names to them. Write two overloaded functions n..

  Implement the fraction class

Implement the Fraction Class, Add the following functions into the definition of the Fraction class above main. The main function already has the calls to those functions written. You must write the required functions into the Fraction class such..

  Complete the recursive method matchstring x string y in the

complete the recursive method matchstring x string y in the code below which will determine whether or not two strings

  In this project you need to write a program called gf2java

in this project you need to write a program called gf2.java to implement the finite field gfpnwhere p is a prime number

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