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.
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.
|