I am working on an assignment to implement an interface, but can't seem to work. It is taking forever to get a response back from the instructor, so I am hoping someone here can help me out.
The book shows some syntax on how to implment an interface, but I can't get my code to work the same way. My code below will compile fine, but from what I grasped of the use of interfaces, my code isn't implmenting a true interface (at least not one that really provides any functionality). The commented out lines are what I was trying to add to the interface... can some one point out my error?
public class StockApp implements StockWatcher {
public static void valueChanged(String tickerSymbol, double newValue) {
if (tickerSymbol.equals(sunTicker)) {
System.out.println("sunTicker...");
System.out.println(tickerSymbol + " stock just went up $" + newValue);
} else if (tickerSymbol.equals(oracleTicker)) {
System.out.println("oracleTicker...");
System.out.println(tickerSymbol + " stock just went up $" + newValue);
} else if (tickerSymbol.equals(ciscoTicker)) {
System.out.println("ciscoTicker...");
System.out.println(tickerSymbol + " stock just went up $" + newValue);
}
}
public static void currentValue(String tickerSymbol, double newValue) {
System.out.println("currentValue...");
System.out.println(tickerSymbol + " stock is currently priced at $" + newValue);
}
public static void main(String[] args) {
currentValue("SUNW", 12.35);
valueChanged("SUNW", 10);
}
}
public interface StockWatcher {
final String sunTicker = "SUNW";
final String oracleTicker = "ORCL";
final String ciscoTicker = "CSCO";
// void valueChanged(String tickerSymbol, double newValue);
// void currentValue(String tickerSymbol, double newValue);
}