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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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