54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
Console.WriteLine("Willkommen zu Aufgabe6");
|
|
|
|
ExamPreparation try1 = new ExamPreparation(new YoloLearningStrategy());
|
|
ExamPreparation try2 = new ExamPreparation(new SolidLearningStrategy());
|
|
|
|
try1.Prepare();
|
|
try2.Prepare();
|
|
|
|
public interface ILearningInterface
|
|
{
|
|
public bool Learn();
|
|
}
|
|
|
|
public class SolidLearningStrategy : ILearningInterface
|
|
{
|
|
public bool Learn()
|
|
{
|
|
Console.WriteLine("Stoff zusammenfassen und wiederholen.");
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public class YoloLearningStrategy : ILearningInterface
|
|
{
|
|
public bool Learn()
|
|
{
|
|
Console.WriteLine("Mut zur Lücke!");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public class ExamPreparation
|
|
{
|
|
public ILearningInterface LearningStrategy;
|
|
|
|
public ExamPreparation(ILearningInterface learningStrategy)
|
|
{
|
|
LearningStrategy = learningStrategy;
|
|
}
|
|
|
|
public void Prepare()
|
|
{
|
|
Console.WriteLine("Starte Klausurvorbereitung…");
|
|
bool result = LearningStrategy.Learn();
|
|
if (result)
|
|
{
|
|
Console.WriteLine("Klausurvorbereitung erfolgreich beendet.");
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Klausurvorbereitung gescheitert, so ein Mist…");
|
|
}
|
|
}
|
|
} |