lehrkraefte:blc:informatik:ffprg1-2020:oop

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lehrkraefte:blc:informatik:ffprg1-2020:oop [2021/03/18 13:30]
michael.greminger
lehrkraefte:blc:informatik:ffprg1-2020:oop [2021/03/26 18:02] (current)
michael.greminger
Line 4: Line 4:
  
 === Präsentation === === Präsentation ===
-{{lehrkraefte:blc:informatik:ffprg1-2020:oop1.pptx}}+{{lehrkraefte:blc:informatik:ffprg1-2020:oop1.pdf}}
  
 === Aufgabe 1 === === Aufgabe 1 ===
Line 19: Line 19:
  
 <hidden Lösungsvorschlag> <hidden Lösungsvorschlag>
-<code python konto_p1.py>+<code python>
 class Konto: class Konto:
     def __init__(self, i, k):     def __init__(self, i, k):
Line 34: Line 34:
 k2 = Konto("Fritz", 12340)  k2 = Konto("Fritz", 12340) 
 print k1.kontostand()   print k1.kontostand()  
-print k2.inhaber()    +print k2.inhaber()  
-</code>+</code>  
 </hidden> </hidden>
  
Line 51: Line 51:
  
 <hidden Lösungsvorschlag> <hidden Lösungsvorschlag>
-<code python konto_p2.py>+<code python>
 from datetime import datetime from datetime import datetime
  
Line 82: Line 82:
 k2 = Konto("Fritz", 12340)  k2 = Konto("Fritz", 12340) 
 print k1.kontostand()   print k1.kontostand()  
-print k2.inhaber()    +print k2.inhaber()   
 </code> </code>
 </hidden> </hidden>
Line 91: Line 91:
  
 <hidden Lösungsvorschlag> <hidden Lösungsvorschlag>
-<code python konto_p3.py>+<code python>
 from datetime import datetime from datetime import datetime
  
Line 106: Line 106:
         return self._kontostand            return self._kontostand   
          
-    def addBuchung(self, bd): +    def addBuchung(self, betragdatum): 
-        = Buchung(bd+        buchungInstanz = Buchung(betragdatum
-        self._buchungen.append(b+        self._buchungen.append(buchungInstanz
-        self._kontostand += b.betrag()+        self._kontostand += buchungInstanz.betrag()
          
 class Buchung: class Buchung:
Line 125: Line 125:
 k1 = Konto("Michael", 1234) k1 = Konto("Michael", 1234)
 k1.addBuchung(100, "13.12.2021") k1.addBuchung(100, "13.12.2021")
-print k1.kontostand() +print k1.kontostand()  
 </code> </code>
 </hidden> </hidden>
Line 134: Line 134:
  
 <hidden Lösungsvorschlag> <hidden Lösungsvorschlag>
-<code python konto_p4.py>+<code python>
 from datetime import datetime from datetime import datetime
  
Line 184: Line 184:
 print k1.kontostandDatum("16.12.2021" print k1.kontostandDatum("16.12.2021"
 print k1.kontostandDatum("18.12.2021" print k1.kontostandDatum("18.12.2021"
-</code>+</code>   
 </hidden> </hidden>
  
Line 190: Line 190:
  
 === Präsentation === === Präsentation ===
- +{{lehrkraefte:blc:informatik:ffprg1-2020:oop2.pdf}}
-{{lehrkraefte:blc:informatik:ffprg1-2020:oop2.pptx}}+
  
 === Aufgabe 5 ===  === Aufgabe 5 === 
Line 198: Line 197:
  
 <hidden Lösungsvorschlag> <hidden Lösungsvorschlag>
-<code python konto_p5.py>+<code python>
 from datetime import datetime from datetime import datetime
  
Line 262: Line 261:
 k1.addBuchung(-300, "17.12.2021") k1.addBuchung(-300, "17.12.2021")
 print k1.zinssatz() print k1.zinssatz()
 +   
 </code> </code>
 </hidden> </hidden>
Line 267: Line 267:
 === Aufgabe 6 ===  === Aufgabe 6 === 
  
 +Füge zur Klasse Konto eine Methode "jahresabschluss()". Diese berechnet aus dem aktuellen Kontostand und dem Zinssatz die Zinsgutschrift, welche als Buchung gutgeschrieben werden soll. Teste diese Methode sowohl für eine Instanz von von Konto als auch vom Supersparkonto.
 +
 +Zusatz: Natürlich ist es auch möglich, die korrekte Zinsgutschrift zu berechnen (wieviele Tage war welcher Betrag auf dem Konto). Wenn jemand mit allem fertig ist, kann das gerne versucht werden.
  
 <hidden Lösungsvorschlag> <hidden Lösungsvorschlag>
-<code python konto_p6.py>+<code python>
 from datetime import datetime from datetime import datetime
  
  • lehrkraefte/blc/informatik/ffprg1-2020/oop.1616070602.txt.gz
  • Last modified: 2021/03/18 13:30
  • by michael.greminger