Computer Science > Research Paper > CSC 236 - Lab 2 (2 programs) ADTs implement vs extend (All)
CSC 236 - Lab 2 (2 programs) ADTs implement vs extend 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 n... umbers 0 through 39 marked on the edge, and it has a three-number combination, which we will call x, y, and 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 the default constructor). - this means need to create two contructors one with 3 arguments and other with no arguments . Second one calls the first with (0,0,0). Somehting like this LockDataStructureClass () { LockDataStructureClass (0,0,0); } LockDataStructureClass( int x, int y, int z) { X = x; Y = y; Z = z; } Also, provide the following methods: To alter the lock’s combination to a new 3-number combination this mean, create method which takes 3 arguments to set X, Y, Z something like this private void alter (int x, int y, int z) { X = x; Y = y; Z = z; ) [Show More]
Last updated: 1 year ago
Preview 1 out of 6 pages
Connected school, study & course
About the document
Uploaded On
Jun 12, 2021
Number of pages
6
Written in
This document has been written for:
Uploaded
Jun 12, 2021
Downloads
0
Views
41
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·