Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

public 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) { // I think something should go here to represent // the hours, minutes, and seconds... 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) { //instantiate a few ExtClock objects ExtClock clockOne = new ExtClock(7, 30, 22, "Mountain"); ExtClock clockTwo = new ExtClock();//tests default constructor ExtClock clockThree = new ExtClock(14, 7, 35, "Central"); //test methods on ExtClock objects ? //print out the values of the ExtClock objects System.out.println(clockOne); System.out.println(clockTwo); System.out.println(clockThree); }//end of main }//end of class

ExtClock.java:36: error: class TestClock is public, should be declared in a file named TestClock.java public class TestClock ^ Clock.java:1: error: class ExtClock is public, should be declared in a file named ExtClock.java public class ExtClock extends Clock ^ Clock.java:36: error: class TestClock is public, should be declared in a file named TestClock.java public class TestClock ^ ExtClock.java:1: error: cannot access Clock public class ExtClock extends Clock ^ bad source file: .\Clock.java file does not contain class C

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_2

Step: 3

blur-text-image_3

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

What is meant by an economic order quantity?

Answered: 1 week ago