Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Worth 3 Points 0 You are given a class named Clock that has three instance varia

ID: 3916211 • Letter: W

Question

Worth 3 Points 0 You are given a class named Clock that has three instance variables: One of type int called hours, another of type boolean called isTicking, and the last one of type int called diff. Write a constructor for the class Clock that takes three parameters-an int, a boolean, and another int. The constructor should set the instance variables to the values provided. 1- public ClockOt nt hours, diff; boolean isTicking; 4 66 characters 5000 maximum Previous Submissions Clear x Code Analysis: Logic Error(s) Remarks and Hints Your constructor seems to have the wrong number of parameters. To create an Integer object you would have to use the new keyword. You almost certainly should be using:

Explanation / Answer

public class Clock

{

int hours,diff;

boolean isTicking;

//constructor

//takes 3 paramenters

//int ,boolean, int

public Clock(int h,boolean ist,int di)

{

//setting values

this.hours = h;

this.isTicking = ist;

this.diff = di;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote