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