Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class ExtClock extends Clock { private String timeZone; public ExtClock() { setTime(0, 0, 0, unknown); } public ExtClock(int hours, int minutes, int seconds, String zone)

class ExtClock extends Clock { private String timeZone;

public ExtClock() { setTime(0, 0, 0, "unknown"); } public ExtClock(int hours, int minutes, int seconds, String zone) { super(hours, minutes, seconds); timeZone = zone; } public void setTime(int hours, int minutes, int seconds, String zone) { timeZone = zone; }

public void setTimeZone(String zone) { timeZone = zone; } public String getTimeZone() { return timeZone; } @Override public String toString() { return (super.toString() + " " + timeZone); } }//end of class

public class 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"); ExtClock clockFour = new ExtClock(); System.out.println(clockOne); System.out.println(clockTwo); System.out.println(clockThree); System.out.println(clockFour); }//end of main }//end of class

can not get the time to print correctly i get

ExtClock@15db9742 Mountain ExtClock@6d06d69c unknown ExtClock@7852e922 Central ExtClock@4e25154f unknown

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

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions