Question: public class clock { private int hours; private int minutes; private int seconds; //constructor (no-argument) public clock() { hours=0; Minutes=0; seconds=0; //parameterized constructor { this.hours-hours;
public class clock { private int hours; private int minutes; private int seconds; //constructor (no-argument) public clock() { hours=0; Minutes=0; seconds=0; //parameterized constructor { this.hours-hours; this.Minutes=Minutes; this.seconds=seconds; } //setters void setHours(int hours){ } this.hours=hours; } void setMinutes(int Minutes){ } this.Minutes=Minutes; } void setSeconds(int Seconds){ } this.Seconds=Seconds; } //getters int getHours() } return hours; } int getMinutes() } return Minutes; } int getSeconds() } return Seconds; } @Override Public String tostring() { return "Hours:"+hours+"minutes:"+minutes+"seconds:"+seconds; } }//end of class clock Class ExtClock extends Clock { Private string TimeZone; Public ExtClock() { super(); //calls clock no-arg constructor timezone="unknown"; } public ExtClock(int hours, int minutes, int seconds, String timezone) { super(hours, Minutes, seconds); this.tiemzone=timezone; } //setters for timezones public void setTimeZone(string timezone) { this.timezone=timezone; }//getters for timezones public string getTimeZone() { return timezone; } public void setTime(int hours, int minutes, int seconds, string timezone) { setHours(Hours); setMinutes(Minutes); setSeconds(Seconds); setTimeZone(TimeZone); } @override public string tostring { return super.tostring()+" "+"Timezone:"+timezone; } }//End of Class ExtClock Public Clock TestClock { public static void main(string() args) { ExtClock ClockOne=new ExtClock(7,30,22,"Mountain") ExtClock ClockTwo = new ExtClock(); ExtClock ClockThree = new ExtClock (14,7,35, "Central"); ClockTwo.sethours(10); ClockTwo.setminutes(20); ClockTwo.setseconds(14); ClockTwo.SetTimeZone("Hills") System.out.printin(ClockOne); System.out.printin(ClockTwo); System.out.printin(ClockThree); }//End Of Main Method }//End Of Class TestClock
typed is as i was show/told and still getting these error
----jGRASP exec: javac -g ClassClock.java ClassClock.java:15: error: not a statement this.hours-hours; ^ ClassClock.java:20: error: illegal start of expression void setHours(int hours){ ^ ClassClock.java:20: error: ';' expected void setHours(int hours){ ^ ClassClock.java:20: error: ';' expected void setHours(int hours){ ^ ClassClock.java:26: error: illegal start of type this.Minutes=Minutes; ^ ClassClock.java:26: error: ';' expected this.Minutes=Minutes; ^ ClassClock.java:26: error:
----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
