Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-12-2008, 01:53 PM
Anseki's Avatar
Member
 
Join Date: Oct 2008
Location: Philippines
Posts: 4
Rep Power: 0
Anseki is on a distinguished road
Question need help..it seems it has an error...
here is the program I'm doing...

import javax.swing.*;
public class adasf
{
public static void main (String[]args)
{
int km, a, fkm;
double p = 8.50, dp = 7.00, fp;
String msg;
msg = JOptionPane.showMessageDialog(null, "This simple program is based on the idea of the Jeepney Fare Matrix: " , "FARE" , JOptionPane.INFORMATION_MESSAGE);
km = Integer.parseInt(JOptionPane.showInputDialog("Plea se Enter The Kilometer/s You're About to Travel:"));
a = JOptionPane.showMessageDialog(null, "Please Choose from the Following: " + "\n[1]Regular" + "\n[2]Student" + "\n[3]Senior" , JOptionPane.INFORMATION_MESSAGE);
switch (a) {
case 1:
if (km>=0&&km<=4)
{fp = p;
JOptionPane.showMessageDialog(null, "You're A Regular Passenger" + "The Kilometer/s Riden is: " + km
+ "The Payment is: " + fp , "FARE" , JOptionPane.INFORMATION_MESSAGE);}
else if (km>4)
{fkm = km - 4;
fp = p + (1*fkm);
JOptionPane.showMessageDialog(null, "You're A Regular Passenger" + "The Kilometer/s Riden is: " + km
+ "The Payment is: " + fp , "FARE" , JOptionPane.INFORMATION_MESSAGE);}
else
JOptionPane.showMessageDialog(null, "THERE IS AN ERROR IN THE INPUTED DATA!!!!!", "ERROR!!!!!" , JOptionPane.ERROR_MESSAGE);
break;
case 2:
if (km>=0&&km<=4)
{fp = dp;
JOptionPane.showMessageDialog(null, "You're A Regular Passenger" + "The Kilometer/s Riden is: " + km
+ "The Payment is: " + fp , "FARE" , JOptionPane.INFORMATION_MESSAGE);}
else if (km>4)
{fkm = km - 4;
fp = p + (1*fkm);
JOptionPane.showMessageDialog(null, "You're A Regular Passenger" + "The Kilometer/s Riden is: " + km
+ "The Payment is: " + fp , "FARE" , JOptionPane.INFORMATION_MESSAGE);}
else
JOptionPane.showMessageDialog(null, "THERE IS AN ERROR IN THE INPUTED DATA!!!!!", "ERROR!!!!!" , JOptionPane.ERROR_MESSAGE);
break;
case 3:
if (km>=0&&km<=4)
{fp = dp;
JOptionPane.showMessageDialog(null, "You're A Regular Passenger" + "The Kilometer/s Riden is: " + km
+ "The Payment is: " + fp , "FARE" , JOptionPane.INFORMATION_MESSAGE);}
else if (km>4)
{fkm = km - 4;
fp = p + (1*fkm);
JOptionPane.showMessageDialog(null, "You're A Regular Passenger" + "The Kilometer/s Riden is: " + km
+ "The Payment is: " + fp , "FARE" , JOptionPane.INFORMATION_MESSAGE);}
else
JOptionPane.showMessageDialog(null, "THERE IS AN ERROR IN THE INPUTED DATA!!!!!", "ERROR!!!!!" , JOptionPane.ERROR_MESSAGE);
break;
}
}
}


but it seems to have an error
here is what it says....:

C:\Program Files\Xinox Software\JCreator LE\JCreator LE\MyProjects\Anseki\adasf.java:9: incompatible types
found : void
required: java.lang.String
msg = JOptionPane.showMessageDialog(null, "This simple program is based on the idea of the Jeepney Fare Matrix: " , "FARE" , JOptionPane.INFORMATION_MESSAGE);
^
C:\Program Files\Xinox Software\JCreator LE\JCreator LE\MyProjects\Anseki\adasf.java:11: cannot resolve symbol
symbol : method showMessageDialog (<nulltype>,java.lang.String,int)
location: class javax.swing.JOptionPane
a = JOptionPane.showMessageDialog(null, "Please Choose from the Following: " + "\n[1]Regular" + "\n[2]Student" + "\n[3]Senior" , JOptionPane.INFORMATION_MESSAGE);
^
2 errors

Process completed.

please help!!!!!!!!:confuse d:
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 10-12-2008, 02:06 PM
Darryl.Burke's Avatar
Senior Member
 
Join Date: Sep 2008
Location: Madgaon, Goa, India
Posts: 745
Rep Power: 2
Darryl.Burke is on a distinguished road
Default
Read the API for JOptionPane#showMessageDailog(...). It doesn't return a String.

db
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 10-14-2008, 12:10 AM
Anseki's Avatar
Member
 
Join Date: Oct 2008
Location: Philippines
Posts: 4
Rep Power: 0
Anseki is on a distinguished road
Default
ok thanks......
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 530 error authentication required rgale JavaServer Pages (JSP) and JSTL 0 05-12-2008 05:28 PM


All times are GMT +2. The time now is 02:30 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org