[SOLVED] Can't pinpoint reason for this error..
Here is my code..I haven't been able to get it to build correctly, am using Netbeans 5.5, and yes it is a school lab so far as converting from fahrenheit to celsius, the rest is for extra credit, which I figure can't hurt.
The error I'm getting is "class or Interface expected" on line 33 - where you see public void Main()...
Also a " ; expected" on the last french brace...
Code:
import javax.swing.*;
import javax.swing.JOptionPane;
public class Main
{
private
double F;
double C;
double K;
public void SetFahrenheit()
{
String Fahrenheit = JOptionPane.showInputDialog(null, "Please enter the temperature in Fahrenheit" );
JOptionPane.showMessageDialog(null, "You entered the temp " + Fahrenheit);
F = Double.parseDouble(Fahrenheit);
}
public void GetCelsius()
{
double Celsius = (5.0 / 9.0) * (F - 32);
JOptionPane.showMessageDialog(null, "The temperature in Celsius is " + Celsius);
}
};
/* public void Main()
{
}*/
public void Main()
public void SetChoices()
{
String choice = JOptionPane(null, "Choose temperature input type: /n 1 for Fahrenheit /n 2 for Celsius /n 3 for Kelvin");
int iChoice = Integer.parseInt(choice);
{
switch (iChoice)
{
case 1: if (iChoice = 1)
{
oTemp.SetFahrenheit();
break;
}
case 2: if (iChoice = 2)
{
oTemp.GetCelsius();
break;
}
case 3: if (iChoice = 3)
{
oTemp.GetKelvin();
break;
}
default :
{
oTemp.SetChoices();
}
}
public static void main (void)
{
Main oTemp = new Main();
oTemp.SetChoices();
};
}
thanks