-1

I created a class called Currency and Exchangeable which is implemented into Saturn, Neptune, and Mars. The three classes extend Currency and implement Exchangeable. When I try to refer to them in my main method it gives me an error "{class name} can not be resolved to a type".

Here is currency:

public abstract class Currency {
    String currencyName;
    double totalFunds;
    public abstract double toEarthDollars(double amount);
    public abstract double fromEarthDollars(double EarthDollars);
}

Below is my main class(Errors are bolded):

public static void main(String[] args){
        Currency mars = new **Mars**(100.00); Currency neptune = new **Neptune**(100.00); 
        Currency saturn = new Saturn(100.00);
        System.out.println("<-- Exchanges -->");
        mars.**exchang**e(saturn, 25.0); neptune.**exchange**(saturn, 10.0); 
        saturn.**exchange**(mars, 122.0); saturn.**exchange**(mars, 121.0);
        
    } 

1 Answers1

-1

Did you import your classes in your main class?

import your.package.path.Mars;
import your.package.path.Neptune;
Evgeniy C
  • 1
  • 2