Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-12-2008, 02:53 PM
Anseki's Avatar
Member
 
Join Date: Oct 2008
Location: Philippines
Posts: 4
Anseki is on a distinguished road
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
Sponsored Links
  #2 (permalink)  
Old 10-12-2008, 03:06 PM
Senior Member
 
Join Date: Sep 2008
Posts: 235
Darryl.Burke is on a distinguished road
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, 01:10 AM
Anseki's Avatar
Member
 
Join Date: Oct 2008
Location: Philippines
Posts: 4
Anseki is on a distinguished road
ok thanks......
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


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

vB 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 06:28 PM


All times are GMT +3. The time now is 10:59 AM.


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