0

I am in a Intro to java class and we were instructed to create a weather app. When ever I compile the code, I get three errors. Keep in mind we are using Git BASH to compile the code, and sublime text to write it. We are not allowed to use any IDE like Eclipse.

Errors:

$ javac src/com/bradywemette/weatherapp/WeatherApp.java
src\com\bradywemette\weatherapp\WeatherApp.java:3: error: package com.bradywemette.converters does not exist
import com.bradywemette.converters.TemperatureConverter;
                                  ^
src\com\bradywemette\weatherapp\WeatherApp.java:10: error: cannot find symbol
                TemperatureConvertor tc = new TemperatureConvertor();
                ^
  symbol:   class TemperatureConvertor
  location: class WeatherApp
src\com\bradywemette\weatherapp\WeatherApp.java:10: error: cannot find symbol
                TemperatureConvertor tc = new TemperatureConvertor();
                                              ^
  symbol:   class TemperatureConvertor
  location: class WeatherApp
3 errors

WeatherApp.java Code:

package com.bradywemette.weatherapp;

import com.bradywemette.converters.TemperatureConverter;
import java.util.Scanner;

public class WeatherApp {

    public static void main(String[] args){

        TemperatureConvertor tc = new TemperatureConvertor();
        Scanner keyboard = new Scanner(System.in);

        System.out.println("Enter a temperature in celsius");
        int tempCelsius = keyboard.nextInt();

        float tempFahrenheit = tc.celsiusToFarhenheit((float)tempCelsius);
        System.out.println(tempCelsius + " is" + tempFahrenheit + " fahrenheit");

    }

}

Temperatureconverter.java Code:

package com.bradywemette.converters; 

public class TemperatureConverter{

    public float celsiusToFarhenheit(float celsius){


        float fahrenheit = celsius * (9f/5f) + 32;
        return fahrenheit;

    }


}

Any help is appreciated.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
  • Typo `TemperatureConverter` `TemperatureConvert**o**r` – Pshemo Jan 30 '18 at 18:57
  • Also you need to add location of your packages to classpath (you can do it via `-cp` parameter). Since you are running your commands from location holding `src` you may need to compile and run with `-cp ./src` option. – Pshemo Jan 30 '18 at 18:59
  • Unfortunately that doesn't work. It states that the file is not found? – ProjectBrady Jan 30 '18 at 20:17
  • This should help you https://stackoverflow.com/questions/13537668/javac-cannot-find-symbol – Guru Jan 30 '18 at 21:22

0 Answers0