Question: Instructions A class named Clock has two instance variables: hours (type int) and isTicking (type boolean). Write a constructor that takes a reference to an

 Instructions A class named Clock has two instance variables: hours (typeint) and isTicking (type boolean). Write a constructor that takes a reference

Instructions A class named Clock has two instance variables: hours (type int) and isTicking (type boolean). Write a constructor that takes a reference to an existing clock object as a parameter and copies that object's instance variables to the object being created. Your task: Write a clock constructor that makes this possible. Just write this constructor -- don't write the whole class or any code outside of the class! Submit Reset History: * (34 of 34) 02/17/20 10:28:02 public clock (object clock) 2- 3 14 5 this.hours = clock.hours ; this.isTicking = clock.isTicking(); } Content Support CodeLab Analysis: Compilation Error(s) Your assignment seems to be backwards. Compiler Errors ClockTest.java:12: error: cannot find symbol public clock_(object Clock) symbol: class object location: class ClockTest.clock 1 error Your Submission 1 public clock (object Clock) 3 this.hours = clock.hours(); this.isTicking = clock.isTicking(); } # 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!