Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Need help with Java program?

So i'm in an intro to java class and i'm making a Fahrenheit to Celsius converter, just for practice. I got it to work inside bluej, but when I try to run the jar file, nothing happens, but the program says that there are no syntax errors! here is my code:

import java.util.*;

public class main

{

private int farenheit;

main ()

{

farenheit = 70;

}

main ( int f )

{

farenheit = f;

}

public void setFarenheit (int differentFarenheit)

{

farenheit = differentFarenheit;

}

public void askUserForFarenheit ()

{

Scanner keyIn;

keyIn = new Scanner (System.in);

System.out.print ("Enter the temperature in Farenheit: ");

String input = keyIn.nextLine ();

int nFarenheit = Integer.parseInt (input) ;

setFarenheit (nFarenheit);

printCelcius ();

}

public void printCelcius ()

{

int f = farenheit;

double a = (f-32)*5;

double b = a/9;

String weather;

if(b > 32 )

{

weather = "It's quite hot, be sure to use sunscreen!";

}

else if (b < 22)

{

weather = "It's a little chilly, wear a sweater!";

}

else

{

weather = "It's nice and cool.";

}

System.out.println ("The temperature in celcius is " + b + " degrees.");

System.out.println ("Forecast: " + weather);

}

}

2 Answers

Relevance
  • Anonymous
    9 years ago
    Favorite Answer

    Have you tried using the Eclipse IDE? it really helps finding errors or making coding easier at times.

    http://www.eclipse.org/downloads/

    You can also use ninite and it will automatically install Eclipse along with other software of your choice

    http://ninite.com/

  • nivens
    Lv 4
    4 years ago

    Why roll your individual whilst there is in all probability a calendar widget you are able to reuse? via the way, the Java API itself supplies many helpful instructions and interfaces: Date, Calendar, GregorianCalendar, DateFormat, and SimpleDateFormat.

Still have questions? Get your answers by asking now.