Oi pessoal, boa tarde. Estou continuando a implementação do meu código de reentrada em Java. Neste momento estou com um problema na entrada de dados pelo teclado. Eu escrevi a seguinte classe:
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.next());
System.out.println("What is the gas model? "); // prompt
genprop.setGasModel(input.next());
System.out.println("Who is(are) the model author(s)? "); // prompt
genprop.setModelAuthors(input.next());
System.out.println("What is the temperature model? "); // prompt
genprop.setTemperatureModel(input.next());
System.out.println("What is the temperature average type? "); // prompt
genprop.setAverageType(input.next());
System.out.println("What is the type of flow? "); // prompt
genprop.setFlow(input.next());
System.out.println("What is the turbulence model? "); // prompt
genprop.setTurbulence(input.next());
System.out.println("What is the artificial dissipation model? "); // prompt
genprop.setDissipation(input.next());
System.out.println("What is the studied physical problem? "); // prompt
genprop.setProblem(input.next());
System.out.println("What is the convergence acceleration technique? "); // prompt
genprop.setTechnique(input.next());
System.out.println("Do you intends to save the solution in predetermined steps? "); // prompt
genprop.setSaving(input.next());
System.out.println("What is the initial flow condition? "); // prompt
genprop.setInitial(input.next());
System.out.println("How many steps in the Newton-Raphson iteration? "); // prompt
genprop.setNewtonRaphson(input.nextInt());
System.out.println("How many steps in the Jacobi iteration? "); // prompt
genprop.setJacobi(input.nextInt());
System.out.println("How many iterations to save? "); // prompt
genprop.setIterationsToSave(input.nextInt());
Nela estou fazendo uma pergunta e esperando a resposta pelo teclado. Só que as perguntas estão saindo uma atrás da outra, sem separação da linha. A saída pelo console está sendo conforme abaixo:
What is the physical formulation?
Thermochemical Non-Equilibrium
What is the gas model?
Who is(are) the model author(s)?
Five Species Chemical Model
What is the temperature model?
What is the temperature average type?
What is the type of flow?
What is the turbulence model?
Ou seja, eu pergunto a formulação, o usuário responde, e em seguida vem duas perguntas em sequência sem aparecer a entrada para a leitura. Mais adiante, são 4 perguntas em sequência e por aí vai. Eu espero que possam me ajudar, obrigado, Edisson Sávio.