add Programmyday form github

This commit is contained in:
Ruben Kallinich
2024-07-25 15:47:46 +02:00
parent 09c8eab938
commit 7362c3d7ce
132 changed files with 3669 additions and 0 deletions

24
Simpsons/Bart.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Simpsons
{
internal class Bart : Familie
{
public Bart()
{
this.vorname = " Bart";
}
public void skateboardGefahren()
{
this.zähler++;
}
public void ausgabe()
{
Console.WriteLine($"{this.zähler} Skateboard gefahren.");
}
}
}

25
Simpsons/Familie.cs Normal file
View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Simpsons
{
internal class Familie
{
protected string? vorname;
protected string? nachname = " Simpsons";
protected string? hautfarbe = " Gelb";
protected string? wohnort = " Evergreen Terrace 742, Springfeield";
protected int zähler;
public void vorstellung()
{
Console.WriteLine($"Vorname: {this.vorname}");
Console.WriteLine($"Nachname: {this.nachname}");
Console.WriteLine($"Hautfarbe: {this.hautfarbe}");
Console.WriteLine($"Wohnort: {this.wohnort}");
}
}
}

24
Simpsons/Homer.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Simpsons
{
internal class Homer : Familie
{
public Homer()
{
this.vorname = " Homer";
}
public void donutsGegessen()
{
this.zähler++;
}
public void ausgabe()
{
Console.WriteLine($"{this.zähler} Dounats gegessen.");
}
}
}

24
Simpsons/Lisa.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Simpsons
{
internal class Lisa : Familie
{
public Lisa()
{
this.vorname = " Lisa";
}
public void saxofonGespielt()
{
this.zähler++;
}
public void ausgabe()
{
Console.WriteLine($"{this.zähler} Saxonfon gespielt.");
}
}
}

25
Simpsons/Maggie.cs Normal file
View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Simpsons
{
internal class Maggie : Familie
{
public Maggie()
{
this.vorname = " Maggie";
}
public void schnullerNuckeln()
{
this.zähler++;
}
public void ausgabe()
{
Console.WriteLine($"{this.zähler} mal am schnuller genuckelt.");
}
}
}

24
Simpsons/Marge.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Simpsons
{
internal class Marge : Familie
{
public Marge()
{
this.vorname = " Marge";
}
public void frisörBesuch()
{
this.zähler++;
}
public void ausgabe()
{
Console.WriteLine($"{this.zähler} mal zum Frisör gegangen.");
}
}
}

24
Simpsons/Program.cs Normal file
View File

@@ -0,0 +1,24 @@
namespace Simpsons
{
internal class Program
{
static void Main(string[] args)
{
Familie[] simpsons = new Familie[5];
simpsons[0] = new Homer();
simpsons[1] = new Marge();
simpsons[2] = new Bart();
simpsons[3] = new Lisa();
simpsons[4] = new Maggie();
foreach (Familie item in simpsons)
{
item.vorstellung();
Console.WriteLine();
}
Bart bart = (Bart)simpsons[2];
bart.skateboardGefahren();
}
}
}

10
Simpsons/Simpsons.csproj Normal file
View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>