generated from hummel/Bank-System
Persistence hinzugefügt (fertig)
parent
5437bcc291
commit
f8f6acd8a3
Binary file not shown.
|
@ -43,6 +43,14 @@ public class Konto implements Serializable {
|
||||||
bewegungen.add(bewegung);
|
bewegungen.add(bewegung);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getKontozaehler() {
|
||||||
|
return kontozaehler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setKontozaehler(int zaehler) {
|
||||||
|
kontozaehler = zaehler;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Konto [nummer=" + nummer + ", inhaber=" + inhaber + "]";
|
return "Konto [nummer=" + nummer + ", inhaber=" + inhaber + "]";
|
||||||
|
|
|
@ -52,8 +52,8 @@ public class Banksystem {
|
||||||
// Betrag mit 2 Nachkommastellen für den User anzeigen lassen
|
// Betrag mit 2 Nachkommastellen für den User anzeigen lassen
|
||||||
String betrag_aktuell = kontostandMitKomma(k);
|
String betrag_aktuell = kontostandMitKomma(k);
|
||||||
k.setBewegungen(betrag_aktuell + " (+)");
|
k.setBewegungen(betrag_aktuell + " (+)");
|
||||||
DateTimeFormatter zeitformat = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
//DateTimeFormatter zeitformat = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
||||||
LocalDateTime zeit = LocalDateTime.now();
|
//LocalDateTime zeit = LocalDateTime.now();
|
||||||
|
|
||||||
return betrag_aktuell;
|
return betrag_aktuell;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class PersistenceService implements Serializable {
|
||||||
FileOutputStream fop = new FileOutputStream("Konten.ser");
|
FileOutputStream fop = new FileOutputStream("Konten.ser");
|
||||||
ObjectOutputStream oos = new ObjectOutputStream(fop);
|
ObjectOutputStream oos = new ObjectOutputStream(fop);
|
||||||
oos.writeObject(konten);
|
oos.writeObject(konten);
|
||||||
|
oos.writeInt(Konto.getKontozaehler());
|
||||||
oos.close();
|
oos.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -31,6 +32,7 @@ public class PersistenceService implements Serializable {
|
||||||
try {
|
try {
|
||||||
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("Konten.ser"));
|
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("Konten.ser"));
|
||||||
konten = (ArrayList<Konto>) ois.readObject();
|
konten = (ArrayList<Konto>) ois.readObject();
|
||||||
|
Konto.setKontozaehler(ois.readInt());
|
||||||
ois.close();
|
ois.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Laden fehlgeschlagen.");
|
System.out.println("Laden fehlgeschlagen.");
|
||||||
|
|
Loading…
Reference in New Issue