Oi pessoal, bom dia.
Estou tentando ler o arquivo abaixo:
PHYSICAL FORMULATION (Formulation): 1
REAL GAS MODEL (Gas_model): 1
MODEL AUTHORS (Model_authors): 1
TEMPERATURE MODEL (Temperature_model): 1
AVERAGE TYPE FOR Trrc (Average_type): 1
NEWTON-RAPHSON ITERATIONS (Newton_Raphson): 2
JACOBI ITERATIONS (Jacobi): 2
FLOW TYPE (Flow): 2
TURBULENCE MODEL (Turbulence): 1
ARTIFICIAL DISSIPATION (Dissipation): 3
PHYSICAL PROBLEM (Problem): 3
ACCELERATION OPTION (Technique): 1
SAVING OPTION (Saving): 1
ITERATIONS TO SAVE (Iterations_to_Saving): 50
INITIAL CONDITION (Initial): 1
FREESTREAM ATTACK ANGLE (theta): 0.0E0
FREESTREAM MACH NUMBER (Mach): 8.78E0
INITIAL DENSITY (Den_init): 0.00326E0
INITIAL PRESSURE (Pr_init): 6.87E2
INITIAL X VELOCITY COMPONENT (U_init): 4.776E3
INITIAL TEMPERATURE (T_init): 6.94E2
CHARACTERISTIC LENGTH (L_char): 2.0E0
CHARACTERISTIC ALTITUDE (Altitude): 4.0E4
X COMPONENT OF THE MAGNETIC FIELD (Bx): 0.0E0
Y COMPONENT OF THE MAGNETIC FIELD (By): 0.15E0
MEAN MAGNETIC PERMEABILITY (Mi_Mag): 1.2566E-6
ELECTRICAL CONDUCTIVITY (Sigma_e): 1.0E3
SCHEME OPTION (Scheme): 3
HIGH ORDER OPTION (High_order): 9
INTERPOLATION OPTION (Interpolation): 3
ACCURACY OPTION (Accuracy): 2
NON-LINEAR LIMITERS TO MUSCL PROC (Limiters): 3
WEIGHT FUNCTION TO SPECTRAL METHOD (Weight): 2
SMOOTHING TERM OPTION (Smoothing): 2
TYPE OF SMOOTHING (Smoothing_type): 1
STEPS FOR SMOOTING ACTUATION (N_smoot): 75
INTERVAL OF SMOOTHING (Delta_N): 5
TIME INTEGRATION (March): 1
CFL NUMBER (CFL): 0.2E0
SMOOTHING COEFFICIENT (ERA_Term): 0.5E0
MAXIMUM ORDER OF RESIDUAL (Order): 3
MAXIMUM NUMBER OF NODES IN QSI (imax): 63
MAXIMUM NUMBER OF NODES IN ETA (jmax): 60
MAXIMUM NUMBER OF ITERATIONS (Max_iter): 50000
CONVERGENCE CRITERIUM (Criterium): 1.0E-9
SHOCK WAVE COEFFICIENT (K2): 0.50E0
BACKGROUND COEFFICIENT (K4): 0.05E0
BETA LIMITER PARAMETER (Beta_limiter): 1.50E0
"a" COORDINATE OF ENO PROCEDURE (Delta_qsi): 0.25E0
"b" COORDINATE OF ENO PROCEDURE (Delta_eta): 0.25E0
PREFERENTIAL OPTION (Preference): 2
C1_hat PREFERENTIAL CONSTANT (C1_hat): 0.3E0
com este código:
package General;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Locale;
import java.util.Scanner;
public class ReadingDataFile
{ public static void main (String[] args) throws FileNotFoundException
// Fluxo de entrada com arquivo
{ Scanner scanner = new Scanner(new File("datas1.txt"));
while (scanner.hasNextLine())
{ String linha = scanner.nextLine();
Scanner linhaScanner = new Scanner(linha);
linhaScanner.useLocale(Locale.US);
String text = linhaScanner.next();
double dataNum = linhaScanner.nextDouble();
System.out.format("%50s: %25.12f %n", text, dataNum);
linhaScanner.close(); }
scanner.close(); } }
O programa compila mas na hora de executar dá um erro:
Exception in thread "main" java.util.InputMismatchException
at java.base/java.util.Scanner.throwFor(Scanner.java:939)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.nextDouble(Scanner.java:2564)
at renecoreflows2d/General.Reading.main(Reading.java:20)
Vocês poderiam me ajudar e mostrar aonde estou errando? Obrigado, Edisson Sávio.