Clock -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Clock.java Author: Lewis/Loftus // // Represents a generic clock. //******************************************************************** / public class Clock extends HomeAppliance { protected String currentTime; p //---------------------------------------------------------------- // Sets up a clock with the specified information. //---------------------------------------------------------------- public Clock (String eManufacturer, double ePrice, double eWeight, String time) { super (eManufacturer, ePrice, eWeight); s currentTime = time; } //---------------------------------------------------------------- // Returns information about the room of the house the clock // is in. //---------------------------------------------------------------- public String room() { return "Living Room"; }
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //----------------------------------------------------------------// Returns information about the current time. //----------------------------------------------------------------public String getTime() { return currentTime; } //----------------------------------------------------------------// Sets a new time for the clock. //----------------------------------------------------------------public void setTime(String newTime) { currentTime = newTime; } //----------------------------------------------------------------// Returns information about this clock as a string. //----------------------------------------------------------------public String toString() { String result = super.toString(); S result += "\nCurrent Time: " + currentTime + "\n"; result += "In Room: " + room(); r return result; } }...
View Full Document

Ask a homework question - tutors are online