Hi there,
I've been doing a program today for my Object Orientated Programming module in college. It's been going quite well, up until now. I've got no errors, up until now. I'm getting 2 error messages where the compiler is telling me that it can't find the symbol in "JOptionPane.showMessageDialog(" with the full stop between "Pane" and "show" being the problem pointed out by the compiler.
Here's my code:
I know there is probably a very simple answer for this, but, I just can't seem to find it.Code:package java_study;
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Java_Study {
public static void main(String[] args) {
String providerAsString, numCallsAsString, USAAsString, AUSAsString, RUSAsString;
char provider;
int numCalls, USA, AUS, RUS;
final float V_RATE_USA = 0.06f, V_RATE_AUS = 0.08f, V_RATE_RUS = 0.24f,
E_RATE_USA = 0.19f, E_RATE_AUS = 0.85f, E_RATE_RUS = 0.92f;
Scanner input = new Scanner(System.in);
providerAsString = JOptionPane.showInputDialog("Which service did you use for the " +
"calls? <V - Vartec, E - Eircom>: ");
provider = providerAsString.charAt(0);
if(provider != 'V')
{
JOptionPane.showMessageDialog(null,"Which service did you use for the calls? " +
"<V - Vartec, E - Eircom>: " + provider + "\nSorry - incorrect choice, it must " +
"be <V>artec or <E>ircom...Goodbye!","Incorrect Choice",JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
if(provider != 'E')
{
JOptionPane.showMessageDialog(null,"Which service did you use for the calls? " +
"<V - Vartec, E - Eircom>: " + provider + "\nSorry - incorrect choice, it must " +
"be <V>artec or <E>ircom...Goodbye!","Incorrect Choice",JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
if(provider == 'V')
{
JOptionPane.showMessageDialog(null,"You chose Vartec, is this correct?","Vartec?",
JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_OPTION);
}
if (provider == 'E')
{
JOptionPane.showMessageDialog(null,"You chose Eircom, is this correct?","Eircom?",
JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_OPTION);
}
numCallsAsString = JOptionPane.showInputDialog("Please enter the total number of calls made in " +
"the month: ");
numCalls = Integer.parseInt(numCallsAsString);
USAAsString = JOptionPane.showInputDialog("Please enter the total number of minutes spent " +
"calling the USA: ");
USA = Integer.parseInt(USAAsString);
AUSAsString = JOptionPane.showInputDialog("Please enter the total number of minutes spent " +
"calling Australia: ");
AUS = Integer.parseInt(AUSAsString);
RUSAsString = JOptionPane.showInputDialog("Please enter the total number of minutes spent " +
"calling Russia: ");
RUS = Integer.parseInt(RUSAsString);
JOptionPane.showMessageDialog(null,"Which service did you use for the calls? " +
"<V - Vartec, E - Eircom>: " + provider + "\nPlease enter the total number " +
"of calls made in the month: " + numCalls + "\nPlease enter the number of " +
"minutes spent calling the USA: " + USA + "\nPlease enter the number of " +
"minutes spent calling Australia: " + AUS + "\nPlease enter the number of " +
"minutes spent calling Russia: " + RUS + "\nThe total cost of your calls " +
"for the month is: EUR" + ((USA*V_RATE_USA)+(AUS*V_RATE_AUS)+(RUS*V_RATE_RUS)) +
"\n\nThe average cost per call made is: EUR" + ("calculate average here")
,"Phone Calculations",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
Thanks in advance for any help, it's much appreciated. :(happy):
- Eoin
