Prelievo + funzione log spostata
This commit is contained in:
@@ -35,7 +35,7 @@ public class MyBank {
|
||||
static Scanner sc = new Scanner(System.in);
|
||||
static final String ERRORE_GENERICO = "Errore: opzione non valida.";
|
||||
static final String ERRORE_CONTI_VUOTO = "Errore: è necessario aggiungere almeno un conto corrente prima di proseguire.";
|
||||
static final String PATH_CONTI = "./src/logic/conti/";
|
||||
public static final String PATH_CONTI = "./src/logic/conti/";
|
||||
private static ArrayList<ContoCorrente> conti = importaConti();
|
||||
|
||||
public static ArrayList<ContoCorrente> getConti() {
|
||||
@@ -61,11 +61,6 @@ public class MyBank {
|
||||
switch (scelta) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
System.out.println("Numero conto: " + conti.getLast().getNumeroContoCorrente());
|
||||
System.out.println("Conto corrente aggiunto con successo.");
|
||||
pausa();
|
||||
break;
|
||||
case 2:
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
@@ -255,23 +250,6 @@ public class MyBank {
|
||||
return contoCorrente;
|
||||
}
|
||||
|
||||
static void log(String messaggio, int numeroContoCorrente) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.sss dd/MM/yyyy");
|
||||
try (BufferedWriter bw = new BufferedWriter(
|
||||
new FileWriter(PATH_CONTI + "movimenti_" + numeroContoCorrente + ".txt", true))) {
|
||||
sb.append("[");
|
||||
sb.append(sdf.format(new Date()));
|
||||
sb.append("] ");
|
||||
sb.append(messaggio);
|
||||
sb.append("\n");
|
||||
|
||||
bw.write(sb.toString());
|
||||
} catch (IOException _) {
|
||||
System.out.println("Errore nella scrittura del movimento.");
|
||||
}
|
||||
}
|
||||
|
||||
static void stampaLog(ArrayList<ContoCorrente> conti) {
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new FileReader(PATH_CONTI + "movimenti_" + selezionaConto(conti).getNumeroContoCorrente() + ".txt"))) {
|
||||
|
||||
Reference in New Issue
Block a user