Stampa conto
This commit is contained in:
@@ -71,4 +71,10 @@ public class ContoCorrente {
|
||||
private void logSaldoCorrente() {
|
||||
MyBank.log("Saldo corrente: " + this.saldo + "\n", this.numeroContoCorrente);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Intestatario: " + this.intestatario.toString() + "\nSaldo corrente: " + this.saldo
|
||||
+ "\nNumero conto corrente: " + this.numeroContoCorrente;
|
||||
}
|
||||
}
|
||||
@@ -45,9 +45,10 @@ public class MyBank {
|
||||
do {
|
||||
System.out.println("Scegliere un'opzione:");
|
||||
System.out.println("1. Aprire conto corrente");
|
||||
System.out.println("2. Versamento");
|
||||
System.out.println("3. Prelievo");
|
||||
System.out.println("4. Mostra movimenti");
|
||||
System.out.println("2. Stampa conto corrente");
|
||||
System.out.println("3. Versamento");
|
||||
System.out.println("4. Prelievo");
|
||||
System.out.println("5. Mostra movimenti");
|
||||
System.out.println("0. Esci");
|
||||
System.out.print("Opzione: ");
|
||||
|
||||
@@ -65,6 +66,14 @@ public class MyBank {
|
||||
pausa();
|
||||
break;
|
||||
case 2:
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
} else {
|
||||
System.out.println(selezionaConto(conti).toString());
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
case 3:
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
} else {
|
||||
@@ -73,7 +82,7 @@ public class MyBank {
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
} else {
|
||||
@@ -82,7 +91,7 @@ public class MyBank {
|
||||
}
|
||||
pausa();
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
if (conti.isEmpty()) {
|
||||
System.out.println(ERRORE_CONTI_VUOTO);
|
||||
} else {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package mybank;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -55,4 +56,10 @@ public class Persona {
|
||||
public String getCognome() {
|
||||
return cognome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "\tNome: " + this.nome + "\n\tCognome: " + this.cognome + "\n\tCodice fiscale: " + this.codiceFiscale
|
||||
+ "\n\tData di nascita: " + new SimpleDateFormat("dd/MM/yyyy").format(dataDiNascita);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user