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: 3 years ago
Preview 1 out of 6 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Jun 11, 2021
Number of pages
6
Written in
All
This document has been written for:
Uploaded
Jun 11, 2021
Downloads
0
Views
75
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·