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

  Write a class that has three overloaded static methods

Write a class that has three overloaded static methods for calculating the areas of the following geometric shapes

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

  Java program to ask user to enter favorite color

Write a Java program to ask the user to enter favorite color, a favorite food, favorite animal, and first name of a friend or relative.

  Create three classes for a customer

a travel manager and have a job of buying a travel package for a customer. You must create three classes for this programming challenge: Customer, Ticket, and TravelManagerDemo.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Write an application that extends jframe

Write an application that extends JFrame and that displays a phrase in every font size from 6 through 20.

  Write a method called rectsum

Write a method called rectSum that will get the sum of a rectangle of elements within a 2D array of ints

  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

  Create a calculator function

This is the code for my trip planner,you need to figure out how to create a calculator function to enable users to calculate their own costs if they choose

  Implementation the two classes

Program Specifications: In the new implementation, the two classes, Student and Grades, are defined with the following operations/methods.

  Instance methods

instance methods: setWidth(double w), setHeight(double h), double getWidth(), double getHeight() and double getArea() * A triangle's area is calculated by width*height*0.5  * all variables are private and methods public.

  Determine product a inferior or normal good

Research illustrates that prices of related goods are given by Py = $5,900 and ; Pz = $90, while average income of individuals consuming this product is M = $55,000. Is X inferior or normal good?

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