Olá pessoal, ainda é sobre a entrada pelo teclado. O meu código sequencial ao inicial é dado por:
package General;
import java.util.Scanner;
/**
*
* @author Edisson Sávio de Góes Maciel
* @version 1.0
* @since 11/2022
* This class performs the input of the flow-field variables necessary to run the renecoreflows2d program.
* The input blocks are divided in four groups, involving the general properties, the physical properties,
* the algorithm properties, and the computational properties.
*
*/
public class ReadingData
{ public static void main (String[] args)
{// Reading data
Scanner input = new Scanner (System.in);
ReadingTableProcedure(); }
public static void ReadingTableProcedure()
{// Reading data
Scanner input = new Scanner (System.in);
// Building the general property variable
GeneralProperties genprop = new GeneralProperties();
System.out.println("What is the physical formulation? "); // prompt
genprop.setFormulation(input.nextLine());
System.out.println("What is the gas model? "); // prompt
genprop.setGasModel(input.nextLine());
System.out.println("Who is(are) the model author(s)? "); // prompt
genprop.setModelAuthors(input.nextLine());
System.out.println("What is the temperature model? "); // prompt
genprop.setTemperatureModel(input.nextLine());
System.out.println("What is the temperature average type? "); // prompt
genprop.setAverageType(input.nextLine());
System.out.println("What is the type of flow? "); // prompt
genprop.setFlow(input.nextLine());
System.out.println("What is the turbulence model? "); // prompt
genprop.setTurbulence(input.nextLine());
System.out.println("What is the artificial dissipation model? "); // prompt
genprop.setDissipation(input.nextLine());
System.out.println("What is the studied physical problem? "); // prompt
genprop.setProblem(input.nextLine());
System.out.println("What is the convergence acceleration technique? "); // prompt
genprop.setTechnique(input.nextLine());
// Building the physical property variable
PhysicalProperties phyprop = new PhysicalProperties();
System.out.println("What is the flow attack angle (in degrees)? "); // prompt
phyprop.setAttackAngle(input.nextDouble());
System.out.println("What is the freestream Mach number? "); // prompt
phyprop.setMach(input.nextDouble());
System.out.println("What is the freestream density (in kg/m3)? "); // prompt
phyprop.setDensityFree(input.nextDouble());
System.out.println("What is the freestream pressure (in Pascal)? "); // prompt
phyprop.setPressureFree(input.nextDouble());
System.out.println("What is the x- freestream velocity (in m/s)? "); // prompt
phyprop.setXVelocity(input.nextDouble());
System.out.println("What is the freestream temperature (in Kelvin)? "); // prompt
phyprop.setTemperatureFree(input.nextDouble());
Aonde eu peço para ele ler variáveis do tipo Double no objeto PhysicalProperties(). Ele está dando o seguinte erro quando ele lê a primeira variável:
Leitura do Double
ou
2 How many steps in the Jacobi iteration? 2 How many iterations to save? 50 What is the flow attack angle (in degrees)? 0.0 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.ReadingData.ReadingTableProcedure(ReadingData.java:64) at renecoreflows2d/General.ReadingData.main(ReadingData.java:21)
Ou seja, ele acusa erro de formato do Double. Peço para que dêem uma olhada e me ajudem mais um pouco. Obrigado, Edisson Sávio.