Results 1 to 3 of 3
- 10-12-2008, 01:53 PM #1
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!!!!!!!!:confused::confused::confused::confuse d:
- 10-12-2008, 02:06 PM #2
Read the API for JOptionPane#showMessageDailog(...). It doesn't return a String.
db
- 10-14-2008, 12:10 AM #3
Similar Threads
-
error 530 error authentication required
By rgale in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 05-12-2008, 05:28 PM
Bookmarks