this is my first help post! i'm very new to java.
Im trying to call an int from the class InputVal into the class Converter..
I'm getting an error that says Cannot make a static reference to the non-static method getJopinput() from the type InputVal
below is my code.. i have no idea whats wrong!
InputVal class
package Shedlock1;
import javax.swing.JOptionPane;
public class InputVal
{
private String binary;
private boolean isValid;
public int jopinput;
public InputVal()
{
isValid = false;
} // end constructor
public void input()
{
do
{
binary = JOptionPane.showInputDialog("Enter an 8 digit number \n"
+ "beginning with a one.");
if ((binary.length() == 8) && (binary.charAt(0) == '1'))
{
for (int i = 0; i < binary.length(); i++)
{
char c = binary.charAt(i);
if ((c == '0') || (c == '1'))
{
isValid = true;
}
else
{
isValid = false;
break;
}// end else
}// end for i
}
else
{
isValid = false;
}// end else
} while (!isValid);
int jopinput = Integer.valueOf(binary);//converts binary to an int
} // end input
public String getBinary()
{
return binary;
}
public int getJopinput ()
{
return jopinput;
}//makes us able to call the int in converter
} // end class InputVal
Converter class
package Shedlock1;
import java.text.NumberFormat;
import javax.swing.JOptionPane;
public class Converter {
public String temp;
public String season;
final double SENTINEL = 109;
public Converter() {
{
InputVal.getJopinput();
int converted = 10001001; // converts input from JOptionPane from
// binary to a number in the decimal
// system
while (converted > SENTINEL) {
if (converted >= SENTINEL) {
converted = (converted / 4);
} // end if
} // end while (Temperatures)
JOptionPane.showMessageDialog(null, "The temperature is "
+ converted + "°F");
}
}
}
any help is greatly appreciated.. sorry for the long codes!

New Topic/Question
Reply




MultiQuote






|