Click here to Skip to main content
15,887,027 members
Home / Discussions / Java
   

Java

 
Questionpagination in java swing Pin
bilalshameem25-Dec-14 23:44
bilalshameem25-Dec-14 23:44 
AnswerRe: pagination in java swing Pin
Richard MacCutchan26-Dec-14 1:05
mveRichard MacCutchan26-Dec-14 1:05 
Question[EDIT] CLASS cannot be resolved to a type Pin
AmbiguousName23-Dec-14 8:56
AmbiguousName23-Dec-14 8:56 
QuestionRe: CLASS cannot be resolved to a type Pin
Richard MacCutchan23-Dec-14 21:38
mveRichard MacCutchan23-Dec-14 21:38 
AnswerRe: [EDIT] CLASS cannot be resolved to a type Pin
alexey_s22-Jan-15 8:15
alexey_s22-Jan-15 8:15 
QuestionGabor Patch Generator Pin
amirsharifzadeh20-Dec-14 22:01
amirsharifzadeh20-Dec-14 22:01 
SuggestionRe: Gabor Patch Generator Pin
Richard MacCutchan20-Dec-14 22:14
mveRichard MacCutchan20-Dec-14 22:14 
QuestionHow to Use Delimiters in my program(Does not work and Crashes) Pin
Kaytlyn Grace Lau20-Dec-14 7:44
Kaytlyn Grace Lau20-Dec-14 7:44 
Hello, I am doing a project for school and I cannot figure out what is wrong.

int AB = 450;
    int BC = 140;
    int CD = 120;
    int DE = 320;
    int EF = 250;
    int FG = 80;
    String Place1, Place2, Place3, Place4, Place5, Place6, Place7, Place8, Place9, Place10;
    double MPG;
    double MPH;
    double Gallon;
    String Trip1;
    double Hour1;
    int Minute1;
    double Money1;
    int Dist1;
    String String;
    Scanner scan = new Scanner(new File("C:\\Users\\Evelyn\\workspace\\ACSL\\src\\testimput"));
    NumberFormat numfmt = NumberFormat.getCurrencyInstance();
    NumberFormat decfmt = new DecimalFormat("00");
    String delims = "[ ]+[,]";
    MPG = scan.nextDouble();
    Gallon = scan.nextDouble();
    MPH = scan.nextDouble();

    Place1 = scan.next();
    Place2 = scan.next();
    Place3 = scan.next();
    Place4 = scan.next();
    Place5 = scan.next();
    Place6 = scan.next();
    Place7 = scan.next();
    Place8 = scan.next();
    Place9 = scan.next();
    Place10 = scan.next();


For the program, there is a textfile that contains exactly:
Quote:
25, 3.79, 50
A, C
E, F
C, G
B, E
A, G


However, when I attempt to run it crashes.

Exception in thread "main" java.util.InputMismatchException
	at java.util.Scanner.throwFor(Unknown Source)
	at java.util.Scanner.next(Unknown Source)
	at java.util.Scanner.nextDouble(Unknown Source)
	at Prog_2014.main(Prog_2014.java:34)


Does anyone know how to fix this? What am I doing wrong and what must I add.
AnswerRe: How to Use Delimiters in my program(Does not work and Crashes) Pin
Richard MacCutchan20-Dec-14 21:06
mveRichard MacCutchan20-Dec-14 21:06 
AnswerRe: How to Use Delimiters in my program(Does not work and Crashes) Pin
Richard MacCutchan21-Dec-14 4:01
mveRichard MacCutchan21-Dec-14 4:01 
GeneralRe: How to Use Delimiters in my program(Does not work and Crashes)(SOLVED) Pin
Kaytlyn Grace Lau21-Dec-14 9:18
Kaytlyn Grace Lau21-Dec-14 9:18 
GeneralRe: How to Use Delimiters in my program(Does not work and Crashes)(SOLVED) Pin
Richard MacCutchan21-Dec-14 22:44
mveRichard MacCutchan21-Dec-14 22:44 
Question[SOLVED] Does not redirect properly Pin
Django_Untaken14-Dec-14 20:52
Django_Untaken14-Dec-14 20:52 
QuestionRe: Does not redirect properly Pin
Richard MacCutchan14-Dec-14 22:19
mveRichard MacCutchan14-Dec-14 22:19 
QuestionLogin Details Authentication Pin
JayantiSh13-Dec-14 12:08
JayantiSh13-Dec-14 12:08 
AnswerRe: Login Details Authentication Pin
Richard MacCutchan13-Dec-14 21:33
mveRichard MacCutchan13-Dec-14 21:33 
GeneralRe: Login Details Authentication Pin
JayantiSh16-Dec-14 3:27
JayantiSh16-Dec-14 3:27 
GeneralRe: Login Details Authentication Pin
TorstenH.17-Dec-14 2:19
TorstenH.17-Dec-14 2:19 
Generaljava Pin
Member 109275319-Dec-14 1:48
Member 109275319-Dec-14 1:48 
GeneralRe: java Pin
Richard MacCutchan9-Dec-14 6:11
mveRichard MacCutchan9-Dec-14 6:11 
GeneralRe: java Pin
TorstenH.11-Dec-14 22:14
TorstenH.11-Dec-14 22:14 
QuestionPassing JTextField Values to MouseListener Interface Pin
Django_Untaken2-Dec-14 3:37
Django_Untaken2-Dec-14 3:37 
AnswerRe: Passing JTextField Values to MouseListener Interface Pin
Richard MacCutchan2-Dec-14 5:27
mveRichard MacCutchan2-Dec-14 5:27 
GeneralRe: Passing JTextField Values to MouseListener Interface Pin
Django_Untaken3-Dec-14 5:52
Django_Untaken3-Dec-14 5:52 
GeneralRe: Passing JTextField Values to MouseListener Interface Pin
Richard MacCutchan3-Dec-14 6:26
mveRichard MacCutchan3-Dec-14 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.