From ece8cee4ded317e7f4dbce5546e3428bffbb46a0 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sat, 24 Feb 2024 17:59:00 +0100 Subject: add my last lesson in 10B --- Info/23_24/02/20/10B/handout.tex | 100 +++++++++++++++++++++++++++++++++++++++ Info/23_24/02/20/10B/schedule.md | 28 +++++++++++ Info/23_24/02/20/10B/slides.md | 95 +++++++++++++++++++++++++++++++++++++ Info/23_24/02/20/10B/topic | 1 + 4 files changed, 224 insertions(+) create mode 100644 Info/23_24/02/20/10B/handout.tex create mode 100644 Info/23_24/02/20/10B/schedule.md create mode 100644 Info/23_24/02/20/10B/slides.md create mode 120000 Info/23_24/02/20/10B/topic (limited to 'Info') diff --git a/Info/23_24/02/20/10B/handout.tex b/Info/23_24/02/20/10B/handout.tex new file mode 100644 index 00000000..a535a4c6 --- /dev/null +++ b/Info/23_24/02/20/10B/handout.tex @@ -0,0 +1,100 @@ +\documentclass[a5paper,landscape]{handout} +\csname endofdump\endcsname +\usepackage{minted} + +\begin{document} +\thispagestyle{empty} + +\subsection*{\underline{Felder von komplexen Datentypen}} + +\begin{tabular}{p{0.4\textwidth} p{0.1\textwidth} p{0.49\textwidth}} + \begin{defbox}{Syntax} + \begin{itemize} + \item \textbf{Datentyp}: + \item \textbf{Deklaration}: + \item \textbf{Initialisierung}: + \end{itemize} + \end{defbox} & & + + \begin{minipage}[t]{0.59\textwidth} + \begin{minted}[escapeinside=$$]{java} +class SPIELAUTOMAT { + // Deklaration Spielwalzen Feld + $\solution{SPIELWALZEN[] walzen;}$ + + // SPIELAUTOMAT Konstruktor + SPIELAUTOMAT($\solution{int n~~~~~~~~~}$) { + // Initialisierung Spielwalzen Feld + $walzen = \solution{new SPIELWALZEN[n];}$ + for (int i = 0; i < $\solution{walzen.length~~~~~~~}$; i++) { + // Initialisierung der einzelnen Spielwalzen + $\solution{walzen[i] = new SPIELWALZE(i*100, 0);}$ + $\solution{}$ + } + } +} + \end{minted} + \end{minipage} \\ +\end{tabular} + +\subsection*{\underline{1 zu n Beziehungen in Java}} + +\begin{tabular}{p{0.49\linewidth} p{0.49\linewidth}} +\vspace{0.5cm} +\begin{tikzpicture}[ +class/.style={ +draw, +rectangle, +minimum width={width("SPIELAUTOMAT")}, +font=\small}] + +\node[class] (sa) at (0,0) {SPIELAUTOMAT}; + +\node[class] (sw) at (7, 0) {SPIELWALZE}; + +\draw (sa.east) edge[above, align=center] node {\small 1 ~~~~ $>$ enthält ~~~~ 3} (sw.west); +\end{tikzpicture} & + +\begin{minipage}[t]{0.49\textwidth} + \begin{minted}[]{java} +class SPIELAUTOMAT { + SPIELWALZEN walze1; + SPIELWALZEN walze2; + SPIELWALZEN walze3; + ... +} + \end{minted} +\end{minipage} \\ + +\LARGE \hspace{5cm} $\Downarrow$ & \hspace{2cm} \LARGE $\Downarrow$ \\ + +\vspace{1cm} +\begin{tikzpicture}[ +class/.style={ +draw, +rectangle, +minimum width={width("SPIELAUTOMAT")}, +font=\small}] + +\node[class] (sa) at (0,0) {SPIELAUTOMAT}; + +\node[class] (sw) at (7, 0) {SPIELWALZE}; + +\draw (sa.east) edge[above, align=center] node {\small 1 ~~~~ $>$ enthält ~~~~ \boldred{n}} (sw.west); +\end{tikzpicture} & + +\vspace{0.5cm} +\begin{minipage}[t]{0.49\textwidth} + \begin{minted}[escapeinside=$$]{java} +class SPIELAUTOMAT { + $\solution{SPIELWALZEN[] walzen;}$ + + SPIELAUTOMAT($\solution{int n~~~~~~~~}$) { + walzen = SPIELWALZE$\solution{[n];}$ + } + ... +} +\end{minted} +\end{minipage} \\ +\end{tabular} +\end{document} diff --git a/Info/23_24/02/20/10B/schedule.md b/Info/23_24/02/20/10B/schedule.md new file mode 100644 index 00000000..e1c9f674 --- /dev/null +++ b/Info/23_24/02/20/10B/schedule.md @@ -0,0 +1,28 @@ +--- +lang: de +geometry: margin=2cm +--- +# Felder von komplexen Datentypen + +* **Klasse**: 10B +* **Datum**: 20.02 + +## Lernziele + +## Verlaufplan + +--------------------------------------------------------------------------------------------------- +Zeit Phase Unterrichtsgeschehen Ziel Methode Medien +----- --------------- -------------------------------------------- ----------- ---------- --------- +5 Intro Mebis Kurs Vorstellung + +5 Motivation Spielautomat mit beliebigen Walzen + +10 Wdh Felder + +10 Uebung Spielwalzenfeld + +10 Uebung Farbfeld + +5 Sicherung +--------------------------------------------------------------------------------------------------- diff --git a/Info/23_24/02/20/10B/slides.md b/Info/23_24/02/20/10B/slides.md new file mode 100644 index 00000000..0a3b88d1 --- /dev/null +++ b/Info/23_24/02/20/10B/slides.md @@ -0,0 +1,95 @@ +--- +author: Florian Fischer +theme: metropolis +aspectratio: 169 +header-includes: | + \makeatletter + \beamer@ignorenonframefalse + \makeatother +--- + +## Zusammengesetze Objekte + +![](topic/../img/explosionszeichnung.png){.center} + +## Spielautomat vereinfacht - objektorientiertes Modell + +\begin{center} +\begin{tikzpicture}[ +class/.style={ +draw, +rectangle, +minimum width={width("SPIELAUTOMAT")}, +font=\small}] + +\node[class] (sa) at (0,0) {SPIELAUTOMAT}; + +\node[class] (sw) at (7, 0) {SPIELWALZE}; + +\draw (sa.east) edge[above, align=center] node {\small 1 ~~~~~ > enthält ~~~~~ 3} (sw.west); +\end{tikzpicture} +\end{center} + +\large +\vspace{1cm} +### \Large Referenzattribute +\pause + +Ein \boldred{Referenzattribut} speichert ein Objekt einer Klasse (**komplexer Datentyp**). + +## Wiederholung Referenzattribute +\large + +* Was war nochmal der Datentyp eines Referenzattributes? +* Wie hat man eine Referenzattribut **initialisiert**? + +\pause +>- Der Name der Klasse (**Bsp.**: `SPIELWALZE`{.java}) +>- `new KONSTRUKTOR(...)`{.java} (**Bsp.**: `new SPIELWALZE()`{.java}) + +## Spielautomat vereinfacht - objektorientiertes Modell + +\begin{center} +\begin{tikzpicture}[ +class/.style={ +draw, +rectangle, +minimum width={width("SPIELAUTOMAT")}, +font=\small}] + +\node[class] (sa) at (0,0) {SPIELAUTOMAT}; + +\node[class] (sw) at (7, 0) {SPIELWALZE}; + +\draw (sa.east) edge[above, align=center] node {\small 1 ~~~~~ > enthält ~~~~~ \only<1>{3}\only<2->{\boldred{n}}} (sw.west); +\end{tikzpicture} +\end{center} + +## Felder von komplexen Datentypen +\large + +* Was könnte der Datentyp eines Feldes von komplexen Datentypen sein? +* Wie hat man ein Element des Feldes initialisiert? + +\pause +>- Der Name der Klasse gefolgt von eckigen Klammern (`SPIELWALZE[]`) +>- `feldname[i] = new KONSTRUKTOR(...)`{.java} (**Bsp.:** `walzen[i] = new SPIELWALZE()`{.java}) + +\pause + +### \faIcon{pencil-alt} Felder von komplexen Datentypen +\pause +>- **Datentyp**: `KLASSENNAME[]` +>- **Deklaration**: `KLASSENNAME[] feldname;`{.java} +>- **Initialisierung**: `feldname = new KLASSENNAME[laenge];`{.java} + +## \faIcon{desktop} Arbeitsauftrag – Mehr Walzen 20min +\large + +1. Ersetze die Referenzattribute der Klasse `SPIELWALZE` im `SPIELAUTOMAT` durch ein Feld +2. Ergänze den Konstruktor des `SPIELAUTOMATS` um die Anzahl der Spielwalzen. +3. Initialisiere das Feld und alle Elemente + **Achte** darauf die Position der Spielwalzen korrekt anzupassen. +4. Implementiere die Methoden `SPIELAUTOMAT.AlleDrehen()`, sowie die Methode `SPIELAUTOMAT.Zeichnen()` durch geeignete `for`{.java}-Schleifen +5. Teste deine Implementierung in BlueJ. +6. **Für Schnelle**: Ersetze die Farben der Spielwalze durch ein Feld und passe die Funktion `SPIELWALZE.Drehen()` entsprechend an. diff --git a/Info/23_24/02/20/10B/topic b/Info/23_24/02/20/10B/topic new file mode 120000 index 00000000..46329b8f --- /dev/null +++ b/Info/23_24/02/20/10B/topic @@ -0,0 +1 @@ +../../../../10/2/Spielautomat/Felder \ No newline at end of file -- cgit v1.2.3