mirror of
https://gitlab.com/harald.mueller/aktuelle.kurse.git
synced 2024-11-27 20:21:56 +01:00
muh
This commit is contained in:
parent
aa73df77bd
commit
7b98301d2a
@ -1,202 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en" ng-app="quizApp" >
|
||||
<head >
|
||||
<meta charset="utf-8">
|
||||
<title>Herdt: Wissenstest</title>
|
||||
|
||||
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
|
||||
|
||||
<link rel="stylesheet" href="css/editor.css">
|
||||
<link rel="stylesheet" href="css/herdt.css">
|
||||
<style>
|
||||
.test {
|
||||
background-color: #9adecc;
|
||||
}
|
||||
.test2 {
|
||||
background-color: #efc082;
|
||||
}
|
||||
.richtig {
|
||||
color: #00a375;
|
||||
}
|
||||
.falsch {
|
||||
color: #f68b01;
|
||||
}
|
||||
|
||||
label.checkbox-label input[type=checkbox],label.checkbox-label input[type="radio"]{
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
bottom: 1px;
|
||||
margin:0px;
|
||||
|
||||
}
|
||||
label.checkbox-label {
|
||||
font-weight:normal;
|
||||
width: 100%;
|
||||
}
|
||||
label.checkbox-label span.content{
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
<style type="text/css" media="print">
|
||||
#hr_show, #review_link, #exit_link, #druken {
|
||||
display:none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="bower_components/jquery/jquery.js"></script>
|
||||
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="bower_components/bootstrap-dialog/src/js/bootstrap-dialog.js"></script>
|
||||
<script src="bower_components/angular/angular.js"></script>
|
||||
<script src="bower_components/angular-route/angular-route.js"></script>
|
||||
<script src="bower_components/angular-resource/angular-resource.js"></script>
|
||||
<script src="js/ngStorage.js"></script>
|
||||
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/controllers.js"></script>
|
||||
|
||||
<script type="text/ng-template" id="start.tpl.html">
|
||||
<p class="text-center"><img src="img/header-logo.png"></p><hr>
|
||||
<h3 class="text-center" ng-cloak>{{quiz.name}}</h3><br><br>
|
||||
<p ng-bind-html="description" class="text-center"></p><br><br>
|
||||
|
||||
<p class="text-center" ng-cloak>Anzahl der Fragen: {{size}}</p>
|
||||
<table width="240px" align="center" style="margin-bottom:20px">
|
||||
<tbody>
|
||||
<tr><td><span class="badge question_correct" style="margin:2px"><a href="#/process/0" class="ng-binding">?</a></span></td>
|
||||
<td>Frage richtig beantwortet</td></tr>
|
||||
<tr><td><span class="badge question_wrong" style="margin:2px"><a href="#/process/0" class="ng-binding">?</a></span></td>
|
||||
<td>Frage falsch beantwortet</td></tr>
|
||||
<tr><td><span class="badge" style="margin:2px"><a href="#/process/0" class="ng-binding">?</a></span></td>
|
||||
<td>Frage noch nicht beantwortet</td></tr>
|
||||
</tbody></table>
|
||||
<p class="text-center"><button class="btn btn-primary" ng-click="go('/process')">Test beginnen</button></p>
|
||||
</script>
|
||||
<script type="text/ng-template" id="process.tpl.html">
|
||||
<div class="row ng-scope">
|
||||
<div class="col-md-10"><img style="margin-bottom: 12px;" src="img/header-logo.png"></div>
|
||||
<div class="col-md-2" style="text-align:right; margin-top:10px"><a class="exit" ng-click="stop()">Beenden</a></div>
|
||||
</div>
|
||||
<div style="font-size: 22px; color: rgb(170, 170, 170); " class="text-center" ng-cloak>{{data.name}}</div>
|
||||
<hr>
|
||||
<h3 class="text-center" ng-cloak>{{question.title}}</h3>
|
||||
<p ng-bind-html="description" class="question-description text-center"></p>
|
||||
|
||||
<div class="answers-area" ng-repeat="one_answer in question.answers" >
|
||||
<div ng-class="{test: !showSubmit && one_answer.correct==1,test2:!showSubmit && (answer==one_answer.id || answer.indexOf(one_answer.id)!= -1) && one_answer.correct != 1}">
|
||||
<label class="checkbox-label">
|
||||
<table>
|
||||
<tr>
|
||||
<td><input ng-checked="{{question.type == '1' ? answer && answer.indexOf(one_answer.id)!= -1 : answer==one_answer.id}}" ng-disabled="!showSubmit" type="{{question.type == '1' ? 'checkbox' : 'radio'}}" value="{{one_answer.id}}" name="answer" id="answer" data-correct="{{one_answer.correct}}" ></td>
|
||||
<td style="padding:10px"><span class="" ng-bind-html="one_answer.details" ></span></td>
|
||||
</table>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4" style="width:33.333%;float:left">
|
||||
<p class="text-left">
|
||||
<a ng-show="showPrev"class="btn btn-primary" href="#/process/{{current-1}}">Vorherige Frage</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4" style="width:33.333%;float:left">
|
||||
<p class="text-center">
|
||||
<a ng-show="showResult" class="btn btn-orange" href="#/results">Testergebnis</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 text-right" style="width:33.333%; float:left;white-space:nowrap;">
|
||||
<button ng-show="showSubmit" ng-click="submit()" class="btn btn-primary" >Bestätigen</button> <a ng-show="showSkip" class="btn btn-primary" href="#/process/{{current+1}}">Überspringen</a> <a ng-show="showNext" class="btn btn-primary" href="#/process/{{current+1}}">Nächste Frage</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p class='skipped text-center' ng-show="showMissed" style="margin-top:20px">
|
||||
Sie haben einige Fragen übersprungen. Bitte gehen Sie zurück und beantworten diese, um den Test abzuschließen. Die nicht beantworteten Fragen sind grau hinterlegt.
|
||||
</p>
|
||||
<br><br><hr>
|
||||
<div style="margin-top: 20px; clear: both;text-align: center;">
|
||||
<p>Frage:</p>
|
||||
<span ng-repeat="i in range" >
|
||||
<span class="badge" ng-class="{'question_correct':results[i-1]==1,'question_wrong':results[i-1]==0,'badge-active': (i-1 == current)}"><a href="#/process/{{i-1}}" >{{i}}</a></span>
|
||||
</span>
|
||||
</div>
|
||||
<br>
|
||||
<div ng-show="reference && !showSubmit"><hr>
|
||||
<h3 class="text-center">Informationen zum Thema</h3><br>
|
||||
<div class="row">
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6" ng-bind-html="reference" style="text-align:center;margin-left:auto; margin-right:auto;min-height:100px;margin-bottom: 20px;margin-button:20px;"></div>
|
||||
<div class="col-md-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
</script>
|
||||
<script type="text/ng-template" id="results.tpl.html">
|
||||
<div class="row ng-scope">
|
||||
<div class="col-md-10"><img style="margin-bottom: 12px;" src="img/header-logo.png"></div>
|
||||
<div class="col-md-2" style="text-align:right; margin-top:10px" id="exit_link"><a class="exit" ng-click="stop()">Beenden</a></div>
|
||||
</div>
|
||||
<div style="font-size: 22px; color: rgb(170, 170, 170); " class="text-center" ng-cloak>{{data.name}}</div>
|
||||
<hr>
|
||||
<p class="text-center"> <span ng-show="passed"><strong>Sie haben den Test bestanden.</strong></span>
|
||||
<span ng-show="!passed && score" ng-cloak><strong>Sie haben den Test leider nicht bestanden. Sie benötigen {{score}}% um den Test zu bestehen.</strong></span>
|
||||
<strong ng-cloak>Sie haben {{percent}}% erreicht.</strong>
|
||||
</p>
|
||||
<p class="text-center" ng-cloak>Sie haben {{sum}} von {{size}} Fragen korrekt beantwortet. <a id="review_link" href='#/process/{{size-1}}' class="link-orange">Zurück zu den Fragen</a></p>
|
||||
<div ng-show="group">
|
||||
<hr>
|
||||
<p class="text-center" ng-cloak><strong>Ihr Wissen wurde als "{{group}}" eingestuft.</strong></p>
|
||||
<p ng-show="group_description" ng-bind-html="group_description"></p>
|
||||
</div>
|
||||
<div ng-show="reference">
|
||||
<hr>
|
||||
<h5 class="text-center" style="font-weight: bold;">Hier finden Sie die Unterlage zum Test</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8 text-center" ng-bind-html="reference" style="margin-bottom: 20px;margin-button:20px;"></div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
|
||||
</div><br>
|
||||
<hr>
|
||||
<table class="results-table">
|
||||
<tr valign="top" >
|
||||
<th>Frage</th><th>Wahr - Falsch</th><th>Informationen zum Thema</th>
|
||||
</tr>
|
||||
<tr valign="top" ng-repeat="(index, quest) in data.questions">
|
||||
<td style="width:40%" ng-cloak>{{quest.title}}</td><td style="width:10%" ng-class="{richtig: results[index],falsch:!results[index]}" ng-cloak>{{results[index] ? 'richtig beantwortet': 'falsch beantwortet' }}</td><td ng-cloak><span ng-bind-html="quest.reference"></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<p id="druken" class="text-center" style="margin:10px"><button class="btn btn-primary" onclick="window.print()">Drucken</button></p>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body >
|
||||
<noscript>
|
||||
<p style="margin:10px">Javascript is disabled in your browser. Page functionality requires Javascript in order to work properly.</p>
|
||||
</noscript>
|
||||
<div class="view-container" style="margin:20px">
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8" ng-view>
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
<hr id="hr_show">
|
||||
<div class="text-center copyright">© <span style="font-weight:bold;color:#00A375">HERDT</span> 2016</div></p
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,202 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en" ng-app="quizApp" >
|
||||
<head >
|
||||
<meta charset="utf-8">
|
||||
<title>Herdt: Wissenstest</title>
|
||||
|
||||
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
|
||||
|
||||
<link rel="stylesheet" href="css/editor.css">
|
||||
<link rel="stylesheet" href="css/herdt.css">
|
||||
<style>
|
||||
.test {
|
||||
background-color: #9adecc;
|
||||
}
|
||||
.test2 {
|
||||
background-color: #efc082;
|
||||
}
|
||||
.richtig {
|
||||
color: #00a375;
|
||||
}
|
||||
.falsch {
|
||||
color: #f68b01;
|
||||
}
|
||||
|
||||
label.checkbox-label input[type=checkbox],label.checkbox-label input[type="radio"]{
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
bottom: 1px;
|
||||
margin:0px;
|
||||
|
||||
}
|
||||
label.checkbox-label {
|
||||
font-weight:normal;
|
||||
width: 100%;
|
||||
}
|
||||
label.checkbox-label span.content{
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
<style type="text/css" media="print">
|
||||
#hr_show, #review_link, #exit_link, #druken {
|
||||
display:none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="bower_components/jquery/jquery.js"></script>
|
||||
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="bower_components/bootstrap-dialog/src/js/bootstrap-dialog.js"></script>
|
||||
<script src="bower_components/angular/angular.js"></script>
|
||||
<script src="bower_components/angular-route/angular-route.js"></script>
|
||||
<script src="bower_components/angular-resource/angular-resource.js"></script>
|
||||
<script src="js/ngStorage.js"></script>
|
||||
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/controllers.js"></script>
|
||||
|
||||
<script type="text/ng-template" id="start.tpl.html">
|
||||
<p class="text-center"><img src="img/header-logo.png"></p><hr>
|
||||
<h3 class="text-center" ng-cloak>{{quiz.name}}</h3><br><br>
|
||||
<p ng-bind-html="description" class="text-center"></p><br><br>
|
||||
|
||||
<p class="text-center" ng-cloak>Anzahl der Fragen: {{size}}</p>
|
||||
<table width="240px" align="center" style="margin-bottom:20px">
|
||||
<tbody>
|
||||
<tr><td><span class="badge question_correct" style="margin:2px"><a href="#/process/0" class="ng-binding">?</a></span></td>
|
||||
<td>Frage richtig beantwortet</td></tr>
|
||||
<tr><td><span class="badge question_wrong" style="margin:2px"><a href="#/process/0" class="ng-binding">?</a></span></td>
|
||||
<td>Frage falsch beantwortet</td></tr>
|
||||
<tr><td><span class="badge" style="margin:2px"><a href="#/process/0" class="ng-binding">?</a></span></td>
|
||||
<td>Frage noch nicht beantwortet</td></tr>
|
||||
</tbody></table>
|
||||
<p class="text-center"><button class="btn btn-primary" ng-click="go('/process')">Test beginnen</button></p>
|
||||
</script>
|
||||
<script type="text/ng-template" id="process.tpl.html">
|
||||
<div class="row ng-scope">
|
||||
<div class="col-md-10"><img style="margin-bottom: 12px;" src="img/header-logo.png"></div>
|
||||
<div class="col-md-2" style="text-align:right; margin-top:10px"><a class="exit" ng-click="stop()">Beenden</a></div>
|
||||
</div>
|
||||
<div style="font-size: 22px; color: rgb(170, 170, 170); " class="text-center" ng-cloak>{{data.name}}</div>
|
||||
<hr>
|
||||
<h3 class="text-center" ng-cloak>{{question.title}}</h3>
|
||||
<p ng-bind-html="description" class="question-description text-center"></p>
|
||||
|
||||
<div class="answers-area" ng-repeat="one_answer in question.answers" >
|
||||
<div ng-class="{test: !showSubmit && one_answer.correct==1,test2:!showSubmit && (answer==one_answer.id || answer.indexOf(one_answer.id)!= -1) && one_answer.correct != 1}">
|
||||
<label class="checkbox-label">
|
||||
<table>
|
||||
<tr>
|
||||
<td><input ng-checked="{{question.type == '1' ? answer && answer.indexOf(one_answer.id)!= -1 : answer==one_answer.id}}" ng-disabled="!showSubmit" type="{{question.type == '1' ? 'checkbox' : 'radio'}}" value="{{one_answer.id}}" name="answer" id="answer" data-correct="{{one_answer.correct}}" ></td>
|
||||
<td style="padding:10px"><span class="" ng-bind-html="one_answer.details" ></span></td>
|
||||
</table>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4" style="width:33.333%;float:left">
|
||||
<p class="text-left">
|
||||
<a ng-show="showPrev"class="btn btn-primary" href="#/process/{{current-1}}">Vorherige Frage</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4" style="width:33.333%;float:left">
|
||||
<p class="text-center">
|
||||
<a ng-show="showResult" class="btn btn-orange" href="#/results">Testergebnis</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 text-right" style="width:33.333%; float:left;white-space:nowrap;">
|
||||
<button ng-show="showSubmit" ng-click="submit()" class="btn btn-primary" >Bestätigen</button> <a ng-show="showSkip" class="btn btn-primary" href="#/process/{{current+1}}">Überspringen</a> <a ng-show="showNext" class="btn btn-primary" href="#/process/{{current+1}}">Nächste Frage</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p class='skipped text-center' ng-show="showMissed" style="margin-top:20px">
|
||||
Sie haben einige Fragen übersprungen. Bitte gehen Sie zurück und beantworten diese, um den Test abzuschließen. Die nicht beantworteten Fragen sind grau hinterlegt.
|
||||
</p>
|
||||
<br><br><hr>
|
||||
<div style="margin-top: 20px; clear: both;text-align: center;">
|
||||
<p>Frage:</p>
|
||||
<span ng-repeat="i in range" >
|
||||
<span class="badge" ng-class="{'question_correct':results[i-1]==1,'question_wrong':results[i-1]==0,'badge-active': (i-1 == current)}"><a href="#/process/{{i-1}}" >{{i}}</a></span>
|
||||
</span>
|
||||
</div>
|
||||
<br>
|
||||
<div ng-show="reference && !showSubmit"><hr>
|
||||
<h3 class="text-center">Informationen zum Thema</h3><br>
|
||||
<div class="row">
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6" ng-bind-html="reference" style="text-align:center;margin-left:auto; margin-right:auto;min-height:100px;margin-bottom: 20px;margin-button:20px;"></div>
|
||||
<div class="col-md-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
</script>
|
||||
<script type="text/ng-template" id="results.tpl.html">
|
||||
<div class="row ng-scope">
|
||||
<div class="col-md-10"><img style="margin-bottom: 12px;" src="img/header-logo.png"></div>
|
||||
<div class="col-md-2" style="text-align:right; margin-top:10px" id="exit_link"><a class="exit" ng-click="stop()">Beenden</a></div>
|
||||
</div>
|
||||
<div style="font-size: 22px; color: rgb(170, 170, 170); " class="text-center" ng-cloak>{{data.name}}</div>
|
||||
<hr>
|
||||
<p class="text-center"> <span ng-show="passed"><strong>Sie haben den Test bestanden.</strong></span>
|
||||
<span ng-show="!passed && score" ng-cloak><strong>Sie haben den Test leider nicht bestanden. Sie benötigen {{score}}% um den Test zu bestehen.</strong></span>
|
||||
<strong ng-cloak>Sie haben {{percent}}% erreicht.</strong>
|
||||
</p>
|
||||
<p class="text-center" ng-cloak>Sie haben {{sum}} von {{size}} Fragen korrekt beantwortet. <a id="review_link" href='#/process/{{size-1}}' class="link-orange">Zurück zu den Fragen</a></p>
|
||||
<div ng-show="group">
|
||||
<hr>
|
||||
<p class="text-center" ng-cloak><strong>Ihr Wissen wurde als "{{group}}" eingestuft.</strong></p>
|
||||
<p ng-show="group_description" ng-bind-html="group_description"></p>
|
||||
</div>
|
||||
<div ng-show="reference">
|
||||
<hr>
|
||||
<h5 class="text-center" style="font-weight: bold;">Hier finden Sie die Unterlage zum Test</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8 text-center" ng-bind-html="reference" style="margin-bottom: 20px;margin-button:20px;"></div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
|
||||
</div><br>
|
||||
<hr>
|
||||
<table class="results-table">
|
||||
<tr valign="top" >
|
||||
<th>Frage</th><th>Wahr - Falsch</th><th>Informationen zum Thema</th>
|
||||
</tr>
|
||||
<tr valign="top" ng-repeat="(index, quest) in data.questions">
|
||||
<td style="width:40%" ng-cloak>{{quest.title}}</td><td style="width:10%" ng-class="{richtig: results[index],falsch:!results[index]}" ng-cloak>{{results[index] ? 'richtig beantwortet': 'falsch beantwortet' }}</td><td ng-cloak><span ng-bind-html="quest.reference"></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<p id="druken" class="text-center" style="margin:10px"><button class="btn btn-primary" onclick="window.print()">Drucken</button></p>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body >
|
||||
<noscript>
|
||||
<p style="margin:10px">Javascript is disabled in your browser. Page functionality requires Javascript in order to work properly.</p>
|
||||
</noscript>
|
||||
<div class="view-container" style="margin:20px">
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8" ng-view>
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
<hr id="hr_show">
|
||||
<div class="text-center copyright">© <span style="font-weight:bold;color:#00A375">HERDT</span> 2016</div></p
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
# Konstruktorn, Getter und Setter
|
||||
|
||||
Kapitel 7 in [JAVA9, Herdt](../2-Unterlagen/00-Buecher/Buch__Java_9_Grundlagen_Programmierung)
|
||||
durcharbeiten.
|
||||
- Übungen auf Seite 88 lösen.
|
||||
- als IntelliJ- oder Eclipse-Export angeben.
|
||||
|
||||
Achtung: In Punkt 1 steht, dass sie die Klassen Circle und SomeMath aus Kapitel 4 benutzen sollen. Es sollte Kapitel 6 heissen.
|
17
m226ab/3-Auftraege-Uebungen/A03-Autopilot.md
Normal file
17
m226ab/3-Auftraege-Uebungen/A03-Autopilot.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Aufgabe Autopilot
|
||||
|
||||
**Ausganslage**: Sie sollen ein Programm schreiben, das eine den folgenden Vorgang in Objektorientierter Sprache Abbildet:
|
||||
|
||||
Der Autopilot des Zugs kriegt das Signal zum Abfahren.
|
||||
|
||||
Er löst seine Bremsen des Zugs.
|
||||
|
||||
Er regelt den Strom des Motors hoch.
|
||||
|
||||
|
||||
**Implemtationsdetails**:
|
||||
Dabei sollen Autopilot, Bremsen und Motor als Klassen implementiert werden die Signale(Meldungen) empfangen können und untereinander in Beziehung stehen. Was sie mit den Signalen machen ist Ihnen überlassen. Sie koennen eine Simple Ausgabe machen, aber auch etwas komplexeres.
|
||||
|
||||
**Hinweis**: Wie kann der Autopilot auf das Objekt der Klasse Bremsen zugreifen? Was braucht es dazu in der Klasse Autopilot?
|
||||
|
||||
Abgabe: Export des Projektes aus Ihrer IDE (IntelliJ oder Eclipse) als zip-File
|
35
m226ab/3-Auftraege-Uebungen/A04-Delegation-Interface.md
Normal file
35
m226ab/3-Auftraege-Uebungen/A04-Delegation-Interface.md
Normal file
@ -0,0 +1,35 @@
|
||||
# "Delegation" -> Erweitern der InterfaceDemo Applikation
|
||||
|
||||
Zeitbedarf: 30-60 min
|
||||
|
||||
**Erweitern der InterfaceDemo Applikation**
|
||||
|
||||
Erweitern sie die Applikation durch eine zusaetzliche Klasse Rectangle (Rechteck).
|
||||
Sie wissen ja, dass ein Quadrat ein Spezialfall eines Rechtecks ist (alle 4 Steiten sind dann gleich lang).
|
||||
|
||||
Man könnte auf die Idee kommen, eine Vererbung (extends) zu machen.
|
||||
Aber genau das soll jetzt grade nicht passieren. Die Idee ist, dass Sie eine "Delegation" machen.
|
||||
Dies wird heute mehr als die Vererbung gemacht, weil es flexibler und mächtiger ist.
|
||||
|
||||
Das heisst, Sie überarbeiten die Klasse Square so, dass Sie trotzdem noch
|
||||
die Methode getArea() von Rectangle benutzen können um die Fläche zu berechnen.
|
||||
|
||||
(Tip: im Square.java muessen sie eine Membervariable "private Rectangle square"
|
||||
definieren und diese im Konstruktor initialisieren. Dann koennen sie in getArea()
|
||||
von Square nur noch square.getArea() aufrufen. Dem sagt man *Delegation*)
|
||||
|
||||
Bitte geben sie den Code von den beiden Klassen Square.java und Rectangle.java per Upload oder in einem Textfile ab (copy/paste).
|
||||
Das erleichtert mir das korrigieren. Danke
|
||||
|
||||
Delegate pattern
|
||||
11:56 min, E, YouTube, 2015
|
||||
Verweis: https://www.youtube.com/watch?v=Xa04E1upEg0
|
||||
|
||||
Replace Inheritance With Delegation
|
||||
2:25 min, E, YouTube, 2014
|
||||
Verweis: https://www.youtube.com/watch?v=QBJigWDBlGE
|
||||
|
||||
|
||||
Tutorial - Delegation In Java and Kotlin
|
||||
12:54 min, E, YouTube, 2017
|
||||
Verweis: https://www.youtube.com/watch?v=zfiohSIZtbo
|
Loading…
Reference in New Issue
Block a user