Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in JAva 1 Override the equals method, first defined in the Object class, for the classes contained in the UML class diagram below

Please write in JAva

image text in transcribed

1 Override the equals method, first defined in the Object class, for the classes contained in the UML class diagram below Requirements 1. Do not duplicate tests in any equals method 2. Methods must be efficient 3. Methods must not crash (i.e., throw exceptions) 4. Add constructors to initialize each object (do not place prompts or reads in the constructors) 5. Remove all "package" statements 6. You may include a main if you wish but I will use my own main for testing Options (Choose One) 1. Write all 4 classes in one file named Lock.java (Java only allows one public class in a file, so do not make the subclasses public; do not make any inner classes) 2. Write all 4 classes in separate files Equality is defined as follows 1. To be equal, both objects must be instances of the same class, additionally 2. Combination: both objects must have the same combination (ie., all fields must be equal) 3. Password: both objects must have the same password 4. Double: both objects must have the same password and the same pin Lock Password Combination password : String first: int second: int third int Double pin: int

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions