I'm doing a rental car in java I need to read from a txt the type of client (char), a range of dates (string) and the amount of passengers (int).
I need to bring this data to be analyzed, for example according to the passenger qtd I make calculations of which car is most appropriate and according to the type of customer I calculate the rates, according to the day of the week has different values.
But I do not know and I did not find any plausible explanation of how do I link the variables in the file to the correct variables in the code can anyone help me?
Method to read the file:
private static void ler() {
File dir = new File("C:\Arquivos");
File arq = new File(dir, "LocadoraCarro.txt");
try {
FileReader fileReader = new FileReader(arq);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String linha = "";
while ( ( linha = bufferedReader.readLine() ) != null) {
System.out.println(linha);
}
fileReader.close();
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
File Format : CUSTOMER_TYPE: QUANTITY_PASSENGERS: DATA1, DATA2, DATA3
Example : Normal: 2: 12Abr2018 (Mon), 13Aug2018 (Ter)