Results 1 to 2 of 2
Thread: JOptionPane problems.
- 02-01-2012, 09:26 PM #1
Member
- Join Date
- Feb 2012
- Location
- Ireland
- Posts
- 1
- Rep Power
- 0
JOptionPane problems.
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.Java 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..gif)
- Eoin
- 02-01-2012, 10:19 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: JOptionPane problems.
Look at the line number the error code give you. Verify that your code on those lines uses an available method (see JOptionPane (Java Platform SE 6) ). You should see that for at least one of your showMessageDialog method calls you are passing incorrect number/variable types to the method (for instance, see line 42)
Similar Threads
-
JOptionPane
By thorobred in forum EclipseReplies: 4Last Post: 04-19-2011, 04:15 AM -
InputStream/Jar Problems/File IO Problems
By rdjava in forum Advanced JavaReplies: 31Last Post: 01-17-2011, 11:12 AM -
Help with JOptionPane
By sanctishit in forum New To JavaReplies: 1Last Post: 03-10-2010, 10:20 AM -
JOptionPane
By whosadork in forum New To JavaReplies: 2Last Post: 10-23-2008, 02:17 AM -
problems with JOptionPane
By oregon in forum AWT / SwingReplies: 2Last Post: 08-05-2007, 05:58 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks