Specify, design, and implement a class

Assignment Help JAVA Programming
Reference no: EM13167804

Specify, design, and implement a class that can 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 entire 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 3-number combination (use 0,0,0 for default arguments in defaut constructor)

Also, provide the following 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.

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

Reference no: EM13167804

Questions Cloud

Describe the ph of a buffer solution consisting : Describe the pH of a buffer solution consisting of 100 mL containing 0.1M CH3COOH and 0.125M CH3COO- , both before and after addition of 10 mL of 0.25M HCl. Ka = 1.8 x 10-5.
Index of the system : I get the critical points are(0,0) and(-2^1/5, 4^1/5). Then I get det(0,0)=2 and det(-2^1/5, 4^1/5)=-10, so index of the system is -8 and the index of periodic orbit is 1, so there's no periodic orbit.
What is the laboratory air pressure in atm : The air in a laboratory was measured with a barometer to be 7.40 x 102 mm Hg. What is the laboratory air pressure in atm?
Determine the variation of temperature within the wall : determine the variation of temperature within the wall and the value of temperature at x=0.1m.
Specify, design, and implement a class : Specify, design, and implement a class that can 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.
Define solution of aqueous trimethylamine is titrated : Calculate the pH of the solution after 10.0, 20.0, and 30.0 mL of acid have been added; pKb of (CH3)3N=4.19 at 25 degrees C
How many pounds will be left after 90 years : Where x is the number of years since the material was put into the vault. If 200 pounds of the material are initially put into the vault, how many pounds will be left after 90 years?
How many non-bonded electrons : The compound BeBr2 has a total of how many shared electrons and how many non-bonded electrons?
State what is the change in the boiling point : What is the change in the boiling point of the aqueous solution? and water how man moles of ions are present is solution

Reviews

Write a Review

JAVA Programming Questions & Answers

  Javascript validation - cgi program

CGI mailer script form-mail.pl to your server's cgi-bin directory, and change the permissions on the script to make it executable - BMIS 310

  What position along the chord does minimum pressure occur

At what position along the chord does the minimum pressure occur? What is special about the point where C p is a maximum?

  Write java program to print strings given at command line

Write a program Average.java which just prints strings that it is given at command line, one per line. If nothing is given at command line, print "No arguments".

  supply a student tester class that tests all methods

Implement a class Student. For the purpose of this exercise, a student has a name and a total quiz score. Supply an appropriate constructor and methods getName( ), addQuiz(int score), getTotalScore( ), and getAverageScore ( ).

  Class named stock to model a stock

Write a class named Stock to model a stock. The properties and methods of the class are shown in Figure 6.22. The metho changePercent computes the percentage of the change in the current vs. the previous closing price.

  Write an application that uses string method region

Write an application that uses String method region - Matches to compare two strings input by the user. The application should input the number of characters to be compared and the starting index of the comparison.

  Returns the object with the largest measure

public static Measurable maximum(Measurable[] objects)that returns the object with the largest measure. Use that method to determine the country with the largest area from an array of

  Develop parent lock method asks for four digit password

Develop the parent lock method (turns lock on/off) which asks for 4 digit password. Navigating to any channel which is in range 99-110 must ask for password when parent lock is on.

  A program that reads a four-digit number from the keyboard

Write a program that reads a four-digit number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, the output should be 12. Hint: Break the string into characters and then convert each character to a va..

  Client class to test implementation of the vector class

Write a client class to test your implementation of the Vector3D class thatyou implemented. Name the package in which this class is defined (projectname) vector3dapp.

  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.

  Demonstrates conditions under which the compareto() method

Write an application that demonstrates conditions under which the compareTo() method retrun a positive number, a negative number, and a zero when used to compare two Strings, Save the file as CompareStringValues.java. Lab Assignment

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