From 7362c3d7cefe7a23e0292456a93cd05c826b12c1 Mon Sep 17 00:00:00 2001 From: Ruben Kallinich Date: Thu, 25 Jul 2024 15:47:46 +0200 Subject: [PATCH] add Programmyday form github --- AudioPlayer/AudioFile.cs | 17 ++ AudioPlayer/AudioPlayer.cs | 55 +++++ AudioPlayer/AudioPlayer.csproj | 10 + AudioPlayer/FLACFile.cs | 21 ++ AudioPlayer/MP3File.cs | 21 ++ AudioPlayer/Program.cs | 20 ++ AudioPlayer/WAVFile.cs | 21 ++ AudioPlayerMusterlösung/AudioFile.cs | 23 ++ AudioPlayerMusterlösung/AudioPlayer.cs | 80 +++++++ .../AudioPlayerMusterlösung.csproj | 10 + AudioPlayerMusterlösung/FLACFile.cs | 17 ++ AudioPlayerMusterlösung/MP3File.cs | 17 ++ AudioPlayerMusterlösung/Program.cs | 34 +++ AudioPlayerMusterlösung/WAVFile.cs | 17 ++ Capitalize/JobVerwaltung.cs | 58 +++++ Capitalize/Jobs.cs | 33 +++ Capitalize/Jobs.csproj | 10 + Capitalize/Program.cs | 18 ++ ConsoleApp1/ConsoleApp1.csproj | 10 + ConsoleApp1/Program.cs | 10 + DoppelteBuchstaben/DoppelteBuchstaben.csproj | 10 + DoppelteBuchstaben/DuplicateChars.cs | 42 ++++ DoppelteBuchstaben/Program.cs | 13 ++ DoublingExtention/DoublingExtention.csproj | 10 + DoublingExtention/Program.cs | 37 +++ E-Book/Audio.cs | 20 ++ E-Book/E-Book.csproj | 11 + E-Book/EBook.cs | 38 +++ E-Book/MediaAssets.cs | 18 ++ E-Book/MediaMath.cs | 16 ++ E-Book/Picture.cs | 30 +++ E-Book/Program.cs | 19 ++ E-Book/Texte.cs | 18 ++ E-Book/Video.cs | 30 +++ EvenOrOddExtention/EvenOrOddExtention.csproj | 10 + EvenOrOddExtention/Program.cs | 22 ++ ExtensionMehtod2/Program.cs | 24 ++ .../SplitWordIntoCountExtensionMethod.csproj | 10 + ExtensionMethods/ExtensionMethods.csproj | 10 + ExtensionMethods/Program.cs | 27 +++ IBANNummerPrüfen/IBANNummerPrüfen.csproj | 10 + IBANNummerPrüfen/IbanPrüfung.cs | 49 ++++ IBANNummerPrüfen/Program.cs | 11 + KFZ/KFZ.csproj | 10 + KFZ/Program.cs | 34 +++ Lohnabrechnung/Angestellter.cs | 42 ++++ Lohnabrechnung/ExternerMitarbeiter.cs | 25 ++ Lohnabrechnung/Lohnabrechnung.csproj | 10 + Lohnabrechnung/Lohnsklaven.cs | 35 +++ Lohnabrechnung/Praktikant.cs | 29 +++ Lohnabrechnung/Program.cs | 17 ++ LohnabrechnungMusterlösung/Angstellter.cs | 47 ++++ LohnabrechnungMusterlösung/Department.cs | 42 ++++ .../ExternerMitarbeiter.cs | 26 +++ .../LohnabrechnungMusterlösung.csproj | 10 + LohnabrechnungMusterlösung/Mitarbeiter.cs | 28 +++ LohnabrechnungMusterlösung/Praktikant.cs | 25 ++ LohnabrechnungMusterlösung/Program.cs | 20 ++ Moped/MitAnhänger.cs | 80 +++++++ Moped/Moped.cs | 80 +++++++ Moped/Moped.csproj | 10 + Moped/Program.cs | 45 ++++ Palindrom/IsPalindrom.cs | 28 +++ Palindrom/Palindrom.csproj | 10 + Palindrom/Program.cs | 14 ++ .../PalindromeExtention.csproj | 10 + PalindromeExtention/Program.cs | 26 +++ Parkplatz/Auto.cs | 22 ++ Parkplatz/Parkboxen.cs | 35 +++ Parkplatz/Parkplatz.cs | 61 +++++ Parkplatz/Parkplatz.csproj | 10 + Parkplatz/Program.cs | 32 +++ Parkplatz2/Auto.cs | 22 ++ Parkplatz2/Parkbox.cs | 49 ++++ Parkplatz2/Parkplatz.cs | 76 ++++++ Parkplatz2/Parkplatz2.csproj | 10 + Parkplatz2/Parkschein.cs | 36 +++ Parkplatz2/Program.cs | 32 +++ Simpsons/Bart.cs | 24 ++ Simpsons/Familie.cs | 25 ++ Simpsons/Homer.cs | 24 ++ Simpsons/Lisa.cs | 24 ++ Simpsons/Maggie.cs | 25 ++ Simpsons/Marge.cs | 24 ++ Simpsons/Program.cs | 24 ++ Simpsons/Simpsons.csproj | 10 + SpielAutomat/Automat.cs | 12 + SpielAutomat/Program.cs | 10 + SpielAutomat/SpielAutomat.csproj | 10 + SplitCharsIntoCountExtentions/Program.cs | 28 +++ .../SplitCharsIntoCountExtentions.csproj | 10 + SplitSentencesIntoCountExtentions/Program.cs | 26 +++ .../SplitSentencesIntoCountExtentions.csproj | 10 + StringCountExtention/Program.cs | 26 +++ .../StringCountExtention.csproj | 10 + Stringaufgabe1/CharString.cs | 25 ++ Stringaufgabe1/Program.cs | 13 ++ Stringaufgabe1/Stringaufgabe1.csproj | 10 + Stringaufgabe2/Analyse.cs | 62 +++++ Stringaufgabe2/Program.cs | 12 + Stringaufgabe2/Stringaufgabe2.csproj | 10 + StudentenDatenbank/Datenbank.cs | 80 +++++++ StudentenDatenbank/Program.cs | 32 +++ StudentenDatenbank/Student.cs | 32 +++ StudentenDatenbank/StudentenDatenbank.csproj | 10 + TvSteuerung/Program.cs | 29 +++ TvSteuerung/TV.cs | 83 +++++++ TvSteuerung/TvSteuerung.csproj | 10 + UmlautsExtentions/Program.cs | 20 ++ UmlautsExtentions/UmlautsExtentions.csproj | 10 + WareHouseSolution/Program.cs | 37 +++ WareHouseSolution/WareHouseSolution.csproj | 10 + WareHouseSolution/Warenhaus.cs | 66 ++++++ Warenkorb/Article.cs | 32 +++ Warenkorb/Books.cs | 36 +++ Warenkorb/DvDs.cs | 34 +++ Warenkorb/Program.cs | 27 +++ Warenkorb/Shoppingcart.cs | 88 +++++++ Warenkorb/Warenkorb.csproj | 10 + programmday.sln | 217 ++++++++++++++++++ programmday/MethodenWahnsinn.csproj | 10 + programmday/Program.cs | 40 ++++ warehouse/Program.cs | 16 ++ warehouse/warehouse.csproj | 10 + warehouse/warenhaus.cs | 54 +++++ zoo-besucher/Adult.cs | 17 ++ zoo-besucher/Child.cs | 17 ++ zoo-besucher/Entrance.cs | 47 ++++ zoo-besucher/Group.cs | 17 ++ zoo-besucher/Program.cs | 19 ++ zoo-besucher/Visitor.cs | 19 ++ zoo-besucher/zoo-besucher.csproj | 11 + 132 files changed, 3669 insertions(+) create mode 100644 AudioPlayer/AudioFile.cs create mode 100644 AudioPlayer/AudioPlayer.cs create mode 100644 AudioPlayer/AudioPlayer.csproj create mode 100644 AudioPlayer/FLACFile.cs create mode 100644 AudioPlayer/MP3File.cs create mode 100644 AudioPlayer/Program.cs create mode 100644 AudioPlayer/WAVFile.cs create mode 100644 AudioPlayerMusterlösung/AudioFile.cs create mode 100644 AudioPlayerMusterlösung/AudioPlayer.cs create mode 100644 AudioPlayerMusterlösung/AudioPlayerMusterlösung.csproj create mode 100644 AudioPlayerMusterlösung/FLACFile.cs create mode 100644 AudioPlayerMusterlösung/MP3File.cs create mode 100644 AudioPlayerMusterlösung/Program.cs create mode 100644 AudioPlayerMusterlösung/WAVFile.cs create mode 100644 Capitalize/JobVerwaltung.cs create mode 100644 Capitalize/Jobs.cs create mode 100644 Capitalize/Jobs.csproj create mode 100644 Capitalize/Program.cs create mode 100644 ConsoleApp1/ConsoleApp1.csproj create mode 100644 ConsoleApp1/Program.cs create mode 100644 DoppelteBuchstaben/DoppelteBuchstaben.csproj create mode 100644 DoppelteBuchstaben/DuplicateChars.cs create mode 100644 DoppelteBuchstaben/Program.cs create mode 100644 DoublingExtention/DoublingExtention.csproj create mode 100644 DoublingExtention/Program.cs create mode 100644 E-Book/Audio.cs create mode 100644 E-Book/E-Book.csproj create mode 100644 E-Book/EBook.cs create mode 100644 E-Book/MediaAssets.cs create mode 100644 E-Book/MediaMath.cs create mode 100644 E-Book/Picture.cs create mode 100644 E-Book/Program.cs create mode 100644 E-Book/Texte.cs create mode 100644 E-Book/Video.cs create mode 100644 EvenOrOddExtention/EvenOrOddExtention.csproj create mode 100644 EvenOrOddExtention/Program.cs create mode 100644 ExtensionMehtod2/Program.cs create mode 100644 ExtensionMehtod2/SplitWordIntoCountExtensionMethod.csproj create mode 100644 ExtensionMethods/ExtensionMethods.csproj create mode 100644 ExtensionMethods/Program.cs create mode 100644 IBANNummerPrüfen/IBANNummerPrüfen.csproj create mode 100644 IBANNummerPrüfen/IbanPrüfung.cs create mode 100644 IBANNummerPrüfen/Program.cs create mode 100644 KFZ/KFZ.csproj create mode 100644 KFZ/Program.cs create mode 100644 Lohnabrechnung/Angestellter.cs create mode 100644 Lohnabrechnung/ExternerMitarbeiter.cs create mode 100644 Lohnabrechnung/Lohnabrechnung.csproj create mode 100644 Lohnabrechnung/Lohnsklaven.cs create mode 100644 Lohnabrechnung/Praktikant.cs create mode 100644 Lohnabrechnung/Program.cs create mode 100644 LohnabrechnungMusterlösung/Angstellter.cs create mode 100644 LohnabrechnungMusterlösung/Department.cs create mode 100644 LohnabrechnungMusterlösung/ExternerMitarbeiter.cs create mode 100644 LohnabrechnungMusterlösung/LohnabrechnungMusterlösung.csproj create mode 100644 LohnabrechnungMusterlösung/Mitarbeiter.cs create mode 100644 LohnabrechnungMusterlösung/Praktikant.cs create mode 100644 LohnabrechnungMusterlösung/Program.cs create mode 100644 Moped/MitAnhänger.cs create mode 100644 Moped/Moped.cs create mode 100644 Moped/Moped.csproj create mode 100644 Moped/Program.cs create mode 100644 Palindrom/IsPalindrom.cs create mode 100644 Palindrom/Palindrom.csproj create mode 100644 Palindrom/Program.cs create mode 100644 PalindromeExtention/PalindromeExtention.csproj create mode 100644 PalindromeExtention/Program.cs create mode 100644 Parkplatz/Auto.cs create mode 100644 Parkplatz/Parkboxen.cs create mode 100644 Parkplatz/Parkplatz.cs create mode 100644 Parkplatz/Parkplatz.csproj create mode 100644 Parkplatz/Program.cs create mode 100644 Parkplatz2/Auto.cs create mode 100644 Parkplatz2/Parkbox.cs create mode 100644 Parkplatz2/Parkplatz.cs create mode 100644 Parkplatz2/Parkplatz2.csproj create mode 100644 Parkplatz2/Parkschein.cs create mode 100644 Parkplatz2/Program.cs create mode 100644 Simpsons/Bart.cs create mode 100644 Simpsons/Familie.cs create mode 100644 Simpsons/Homer.cs create mode 100644 Simpsons/Lisa.cs create mode 100644 Simpsons/Maggie.cs create mode 100644 Simpsons/Marge.cs create mode 100644 Simpsons/Program.cs create mode 100644 Simpsons/Simpsons.csproj create mode 100644 SpielAutomat/Automat.cs create mode 100644 SpielAutomat/Program.cs create mode 100644 SpielAutomat/SpielAutomat.csproj create mode 100644 SplitCharsIntoCountExtentions/Program.cs create mode 100644 SplitCharsIntoCountExtentions/SplitCharsIntoCountExtentions.csproj create mode 100644 SplitSentencesIntoCountExtentions/Program.cs create mode 100644 SplitSentencesIntoCountExtentions/SplitSentencesIntoCountExtentions.csproj create mode 100644 StringCountExtention/Program.cs create mode 100644 StringCountExtention/StringCountExtention.csproj create mode 100644 Stringaufgabe1/CharString.cs create mode 100644 Stringaufgabe1/Program.cs create mode 100644 Stringaufgabe1/Stringaufgabe1.csproj create mode 100644 Stringaufgabe2/Analyse.cs create mode 100644 Stringaufgabe2/Program.cs create mode 100644 Stringaufgabe2/Stringaufgabe2.csproj create mode 100644 StudentenDatenbank/Datenbank.cs create mode 100644 StudentenDatenbank/Program.cs create mode 100644 StudentenDatenbank/Student.cs create mode 100644 StudentenDatenbank/StudentenDatenbank.csproj create mode 100644 TvSteuerung/Program.cs create mode 100644 TvSteuerung/TV.cs create mode 100644 TvSteuerung/TvSteuerung.csproj create mode 100644 UmlautsExtentions/Program.cs create mode 100644 UmlautsExtentions/UmlautsExtentions.csproj create mode 100644 WareHouseSolution/Program.cs create mode 100644 WareHouseSolution/WareHouseSolution.csproj create mode 100644 WareHouseSolution/Warenhaus.cs create mode 100644 Warenkorb/Article.cs create mode 100644 Warenkorb/Books.cs create mode 100644 Warenkorb/DvDs.cs create mode 100644 Warenkorb/Program.cs create mode 100644 Warenkorb/Shoppingcart.cs create mode 100644 Warenkorb/Warenkorb.csproj create mode 100644 programmday.sln create mode 100644 programmday/MethodenWahnsinn.csproj create mode 100644 programmday/Program.cs create mode 100644 warehouse/Program.cs create mode 100644 warehouse/warehouse.csproj create mode 100644 warehouse/warenhaus.cs create mode 100644 zoo-besucher/Adult.cs create mode 100644 zoo-besucher/Child.cs create mode 100644 zoo-besucher/Entrance.cs create mode 100644 zoo-besucher/Group.cs create mode 100644 zoo-besucher/Program.cs create mode 100644 zoo-besucher/Visitor.cs create mode 100644 zoo-besucher/zoo-besucher.csproj diff --git a/AudioPlayer/AudioFile.cs b/AudioPlayer/AudioFile.cs new file mode 100644 index 0000000..82b953a --- /dev/null +++ b/AudioPlayer/AudioFile.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.IO.Enumeration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayer +{ + abstract class AudioFile + { + protected string fileName; + protected string speicherOrt; + + public abstract void Play(); + } +} diff --git a/AudioPlayer/AudioPlayer.cs b/AudioPlayer/AudioPlayer.cs new file mode 100644 index 0000000..b9d35bc --- /dev/null +++ b/AudioPlayer/AudioPlayer.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.NetworkInformation; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayer +{ + internal class AudioPlayer + { + private int id; + private AudioFile[] player; + private Random rnd = new Random(); + public AudioPlayer(int cnt) + { + //this.id = id; + this.player = new AudioFile[cnt]; + } + public void AddFile(AudioFile file) + { + for (int i = 0; i < player.Length; i++) + { + if (player[i] is null) + { + this.player[i] = file; + break; + } + } + } + public void RemoveFile(int id) + { + if (id >= 0 && id < player.Length) + { + player[id] = null; + } + } + public void Play(AudioFile file) + { + file.Play(); + } + public void PlayAll() + { + player = player.OrderBy(i => rnd.Next(player.Length)).ToArray(); + for (int i = 0; i < player.Length; i++) + { + if (player[i] is not null) + { + player[i].Play(); + } + } + } + } +} diff --git a/AudioPlayer/AudioPlayer.csproj b/AudioPlayer/AudioPlayer.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/AudioPlayer/AudioPlayer.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/AudioPlayer/FLACFile.cs b/AudioPlayer/FLACFile.cs new file mode 100644 index 0000000..05d5438 --- /dev/null +++ b/AudioPlayer/FLACFile.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayer +{ + internal class FLACFile : AudioFile + { + public FLACFile(string fileName, string speicherOrt) + { + this.fileName = fileName; + this.speicherOrt = speicherOrt; + } + public override void Play() + { + Console.WriteLine($"{this.fileName} von {this.speicherOrt} vom Typ FLAC wird abgespielt."); + } + } +} diff --git a/AudioPlayer/MP3File.cs b/AudioPlayer/MP3File.cs new file mode 100644 index 0000000..61e4074 --- /dev/null +++ b/AudioPlayer/MP3File.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayer +{ + internal class MP3File : AudioFile + { + public MP3File(string fileName, string speicherOrt) + { + this.fileName = fileName; + this.speicherOrt = speicherOrt; + } + public override void Play() + { + Console.WriteLine($"{this.fileName} von {this.speicherOrt} vom Typ MP3 wird abgespielt."); + } + } +} diff --git a/AudioPlayer/Program.cs b/AudioPlayer/Program.cs new file mode 100644 index 0000000..2ccb7c2 --- /dev/null +++ b/AudioPlayer/Program.cs @@ -0,0 +1,20 @@ +namespace AudioPlayer +{ + internal class Program + { + static void Main(string[] args) + { + AudioFile song1 = new MP3File("An Ocean Between Us","bungabunga"); + AudioFile song2 = new FLACFile("Lie to me","ungabunga"); + AudioFile song3 = new MP3File("Fly high", "ungabungabunga"); + AudioFile song4 = new WAVFile("Forever", "bungaunga"); + AudioPlayer player = new AudioPlayer(5); + player.AddFile(song1); + player.AddFile(song2); + player.AddFile(song3); + player.AddFile(song4); + player.PlayAll(); + + } + } +} \ No newline at end of file diff --git a/AudioPlayer/WAVFile.cs b/AudioPlayer/WAVFile.cs new file mode 100644 index 0000000..e3440e0 --- /dev/null +++ b/AudioPlayer/WAVFile.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayer +{ + internal class WAVFile : AudioFile + { + public WAVFile(string fileName, string speicherOrt) + { + this.fileName = fileName; + this.speicherOrt = speicherOrt; + } + public override void Play() + { + Console.WriteLine($"{this.fileName} von {this.speicherOrt} vom Typ WAV wird abgespielt."); + } + } +} diff --git a/AudioPlayerMusterlösung/AudioFile.cs b/AudioPlayerMusterlösung/AudioFile.cs new file mode 100644 index 0000000..e06b2ef --- /dev/null +++ b/AudioPlayerMusterlösung/AudioFile.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayerMusterlösung +{ + abstract class AudioFile + { + private string fileName; + public AudioFile(string filename) + { + this.fileName = filename; + } + public string GetFileName() + { + return fileName; + } + public abstract void Play(); + + } +} diff --git a/AudioPlayerMusterlösung/AudioPlayer.cs b/AudioPlayerMusterlösung/AudioPlayer.cs new file mode 100644 index 0000000..66767c0 --- /dev/null +++ b/AudioPlayerMusterlösung/AudioPlayer.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayerMusterlösung +{ + internal class AudioPlayer + { + private AudioFile[] audiofiles; + + public AudioPlayer(int max) + { + audiofiles = new AudioFile[max]; + } + public void AddFile(AudioFile audiofile) + { + for (int i = 0; i < audiofiles.Length; i++) + { + if (audiofiles[i] is null) + { + audiofiles[i] = audiofile; + break; + } + } + } + public void RemoveFile(int id) + { + if (id >= 0 && id < audiofiles.Length) + { + audiofiles[id] = null; + } + } + public void Play(int id) + { + if (id >= 0 && id < audiofiles.Length && audiofiles[id] is null) + { + audiofiles[id].Play(); + } + } + public void PlayAll() + { + foreach (AudioFile audio in audiofiles) + { + if (audio is not null) + { + audio.Play(); + } + } + } + public void PlayShuffle() + { + Random rnd = new Random(); + AudioFile[] playFiles = new AudioFile[audiofiles.Length]; + for (int i = 0; i < playFiles.Length; i++) + { + playFiles[i] = audiofiles[i]; + } + while (playFiles.Length > 0) + { + int playFile = rnd.Next(playFiles.Length); + if (playFiles[playFile] is not null) + { + playFiles[playFile].Play(); + } + AudioFile[] newArray = new AudioFile[playFiles.Length - 1]; + for (int i = 0; i < playFile; i++) + { + newArray[i] = playFiles[i]; + } + for (int i = playFile; i < newArray.Length; i++) + { + newArray[i] = playFiles[i + 1]; + } + playFiles = newArray; + } + } + } +} diff --git a/AudioPlayerMusterlösung/AudioPlayerMusterlösung.csproj b/AudioPlayerMusterlösung/AudioPlayerMusterlösung.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/AudioPlayerMusterlösung/AudioPlayerMusterlösung.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/AudioPlayerMusterlösung/FLACFile.cs b/AudioPlayerMusterlösung/FLACFile.cs new file mode 100644 index 0000000..cb82b91 --- /dev/null +++ b/AudioPlayerMusterlösung/FLACFile.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayerMusterlösung +{ + internal class FLACFile : AudioFile + { + public FLACFile(string filename) : base(filename) { } + public override void Play() + { + Console.WriteLine($"FLAC: {GetFileName()}"); + } + } +} diff --git a/AudioPlayerMusterlösung/MP3File.cs b/AudioPlayerMusterlösung/MP3File.cs new file mode 100644 index 0000000..ebe9fa6 --- /dev/null +++ b/AudioPlayerMusterlösung/MP3File.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayerMusterlösung +{ + internal class MP3File : AudioFile + { + public MP3File(string filename) : base(filename) { } + public override void Play() + { + Console.WriteLine($"MP3: {GetFileName()}"); + } + } +} diff --git a/AudioPlayerMusterlösung/Program.cs b/AudioPlayerMusterlösung/Program.cs new file mode 100644 index 0000000..c3cbf16 --- /dev/null +++ b/AudioPlayerMusterlösung/Program.cs @@ -0,0 +1,34 @@ +namespace AudioPlayerMusterlösung +{ + internal class Program + { + static void Main(string[] args) + { + AudioPlayer iPod = new AudioPlayer(99); + iPod.AddFile(new MP3File("titel 1")); + iPod.AddFile(new MP3File("titel 2")); + iPod.AddFile(new MP3File("titel 3")); + iPod.AddFile(new MP3File("titel 4")); + iPod.AddFile(new MP3File("titel 5")); + iPod.AddFile(new WAVFile("titel 6")); + iPod.AddFile(new WAVFile("titel 7")); + iPod.AddFile(new WAVFile("titel 8")); + iPod.AddFile(new WAVFile("titel 9")); + iPod.AddFile(new WAVFile("titel 10")); + iPod.AddFile(new WAVFile("titel 11")); + iPod.AddFile(new WAVFile("titel 12")); + iPod.AddFile(new FLACFile("titel 13")); + iPod.AddFile(new FLACFile("titel 14")); + iPod.AddFile(new FLACFile("titel 15")); + iPod.AddFile(new FLACFile("titel 16")); + iPod.AddFile(new FLACFile("titel 17")); + iPod.AddFile(new FLACFile("titel 18")); + iPod.AddFile(new MP3File("titel 19")); + iPod.AddFile(new MP3File("titel 20")); + + iPod.PlayAll(); + Console.WriteLine(); + iPod.PlayShuffle(); + } + } +} \ No newline at end of file diff --git a/AudioPlayerMusterlösung/WAVFile.cs b/AudioPlayerMusterlösung/WAVFile.cs new file mode 100644 index 0000000..467dfc1 --- /dev/null +++ b/AudioPlayerMusterlösung/WAVFile.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AudioPlayerMusterlösung +{ + internal class WAVFile : AudioFile + { + public WAVFile(string filename) : base(filename) { } + public override void Play() + { + Console.WriteLine($"WAV: {GetFileName()}"); + } + } +} diff --git a/Capitalize/JobVerwaltung.cs b/Capitalize/JobVerwaltung.cs new file mode 100644 index 0000000..eedbb9e --- /dev/null +++ b/Capitalize/JobVerwaltung.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jobs +{ + internal class JobVerwaltung + { + private Queue jobsQue = new Queue(); + public void AddJob(Jobs jobs) + { + jobsQue.Enqueue(jobs); + int jobId = jobsQue.Count(); + if (jobId > 1) + { + Console.WriteLine($"Es sind noch {jobId} Jobs offen"); + Console.WriteLine("-----------------------------------"); + Console.WriteLine(); + } + else + { + Console.WriteLine($"Es ist noch {jobId} Job offen."); + Console.WriteLine("-----------------------------------"); + Console.WriteLine(); + } + } + public void GetJobDone() + { + if (jobsQue.Count() == 0) + { + Console.WriteLine("Es sind keine Jobs mehr vorhanden."); + Console.WriteLine("-----------------------------------"); + Console.WriteLine(); + } + else + { + Jobs nextJobs = jobsQue.Dequeue(); + Console.WriteLine($"Nächst Job ist {nextJobs}"); + int jobId = jobsQue.Count(); + Console.WriteLine($"Es sind noch {jobId} offen"); + Console.WriteLine("-----------------------------------"); + Console.WriteLine(); + } + } + public void ShowAllJobs() + { + Console.WriteLine("Alle vorhandenen Jobs: "); + foreach (Jobs jobs in jobsQue) + { + Console.WriteLine($"Folgende Jobs stehen noch aus: {jobs.GetBezeichnung()}"); + Console.WriteLine($"Der auftrag kommt von: {jobs.GetAuftraggeber()}"); + Console.WriteLine($"Und wird in der Zeit von: {jobs.GetDauer()} Minuten bearbeitet"); + } + } + } +} diff --git a/Capitalize/Jobs.cs b/Capitalize/Jobs.cs new file mode 100644 index 0000000..f5d596f --- /dev/null +++ b/Capitalize/Jobs.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jobs +{ + internal class Jobs + { + private string? bezeichnung; + private string? auftraggeber; + private int dauer; + public Jobs(string jobBezeinung, string auftraggeber, int dauer) + { + this.bezeichnung = jobBezeinung; + this.auftraggeber = auftraggeber; + this.dauer = dauer; + } + public string GetBezeichnung() + { + return this.bezeichnung; + } + public string GetAuftraggeber() + { + return this.auftraggeber; + } + public int GetDauer() + { + return this.dauer; + } + } +} diff --git a/Capitalize/Jobs.csproj b/Capitalize/Jobs.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Capitalize/Jobs.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Capitalize/Program.cs b/Capitalize/Program.cs new file mode 100644 index 0000000..40f84b5 --- /dev/null +++ b/Capitalize/Program.cs @@ -0,0 +1,18 @@ +using System.Runtime.InteropServices; +using System.Threading.Channels; + +namespace Jobs +{ + internal class Program + { + static void Main(string[] args) + { + JobVerwaltung jobs = new JobVerwaltung(); + jobs.AddJob(new Jobs("print","office",104)); + jobs.AddJob(new Jobs("Menu","ich",80)); + jobs.AddJob(new Jobs("Kaffee kochen","der Chef mir",8)); + jobs.GetJobDone(); + jobs.ShowAllJobs(); + } + } +} \ No newline at end of file diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs new file mode 100644 index 0000000..10a74e0 --- /dev/null +++ b/ConsoleApp1/Program.cs @@ -0,0 +1,10 @@ +namespace ConsoleApp1 +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } + } +} \ No newline at end of file diff --git a/DoppelteBuchstaben/DoppelteBuchstaben.csproj b/DoppelteBuchstaben/DoppelteBuchstaben.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/DoppelteBuchstaben/DoppelteBuchstaben.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/DoppelteBuchstaben/DuplicateChars.cs b/DoppelteBuchstaben/DuplicateChars.cs new file mode 100644 index 0000000..7efa357 --- /dev/null +++ b/DoppelteBuchstaben/DuplicateChars.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DoppelteBuchstaben +{ + internal class DuplicateChars + { + private string _text; + public bool ContainsDuplicateChars(string text) + { + for (int i = 0; i < text.Length; i++) + { + for (int j = i + 1; j < text.Length; j++) + { + if (text[i] == text[j]) + { + return true; + } + } + } + return false; + } + public string RemoveDuplicateChars(string text) + { + for (int i = 0; i < text.Length; i++) + { + for (int j = i + 1; j < text.Length; j++) + { + if (text[i] == text[j]) + { + this._text = text.Remove(j); + return this._text; + } + } + } + return text; + } + } +} diff --git a/DoppelteBuchstaben/Program.cs b/DoppelteBuchstaben/Program.cs new file mode 100644 index 0000000..bd91338 --- /dev/null +++ b/DoppelteBuchstaben/Program.cs @@ -0,0 +1,13 @@ +namespace DoppelteBuchstaben +{ + internal class Program + { + static void Main(string[] args) + { + DuplicateChars duplicate = new DuplicateChars(); + string text = Console.ReadLine(); + Console.WriteLine(duplicate.ContainsDuplicateChars(text)); + Console.WriteLine(duplicate.RemoveDuplicateChars(text)); + } + } +} \ No newline at end of file diff --git a/DoublingExtention/DoublingExtention.csproj b/DoublingExtention/DoublingExtention.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/DoublingExtention/DoublingExtention.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/DoublingExtention/Program.cs b/DoublingExtention/Program.cs new file mode 100644 index 0000000..a8d6e1d --- /dev/null +++ b/DoublingExtention/Program.cs @@ -0,0 +1,37 @@ +using System.Runtime.CompilerServices; +using System.Security.Cryptography.X509Certificates; + +namespace DoublingExtention +{ + internal class Program + { + static void Main(string[] args) + { + string input = "Libelle"; + Console.WriteLine(input.Doubling()); + } + } + static class DublingExtention + { + public static string Doubling(this string input) + { + char previosChar = '\0'; //PreviosChar wird beim ersten druchlauf nicht geprüft. + char doubling; + for (int i = 0; i < input.Length; i++) + { + char currentChar = input[i]; + if (i != 0) + { + previosChar = input[i - 1]; + } + if (currentChar == previosChar) + { + doubling = currentChar; + return $"Folgende doppelte Buchstaben wurden gefunden: {doubling}"; + } + } + return "Es wurden keine doppelten Buchstaben gefunden."; + } + } + +} \ No newline at end of file diff --git a/E-Book/Audio.cs b/E-Book/Audio.cs new file mode 100644 index 0000000..eafb0e0 --- /dev/null +++ b/E-Book/Audio.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace E_Book +{ + internal class Audio : MediaAssets + { + private decimal ptis; + private decimal audioPages; + public Audio(decimal ptis) + { + this.ptis = ptis; + this.audioPages = 0; + } + } +} diff --git a/E-Book/E-Book.csproj b/E-Book/E-Book.csproj new file mode 100644 index 0000000..6ea9799 --- /dev/null +++ b/E-Book/E-Book.csproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + E_Book + enable + enable + + + diff --git a/E-Book/EBook.cs b/E-Book/EBook.cs new file mode 100644 index 0000000..0f4ec51 --- /dev/null +++ b/E-Book/EBook.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace E_Book +{ + internal class EBook + { + private string? author; + private string? publishingYear; + private MediaAssets[] media; + private decimal totalPageCount; + + public EBook(int number) + { + media = new MediaAssets[number]; + } + public bool AddMediaAsset(MediaAssets pageCount) + { + for (int i = 0; i < media.Length; i++) + { + if (media[i] is null) + { + media[i] = pageCount; + totalPageCount += media[i].GetPageCount(); + return true; + } + } + return false; + } + public void PrintInof() + { + Console.WriteLine($"Das Buch hat {totalPageCount} Seiten,"); + } + } +} diff --git a/E-Book/MediaAssets.cs b/E-Book/MediaAssets.cs new file mode 100644 index 0000000..a435df0 --- /dev/null +++ b/E-Book/MediaAssets.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace E_Book +{ + internal class MediaAssets + { + protected decimal pageCount; + + public decimal GetPageCount() + { + return pageCount; + } + } +} diff --git a/E-Book/MediaMath.cs b/E-Book/MediaMath.cs new file mode 100644 index 0000000..8dfd6fc --- /dev/null +++ b/E-Book/MediaMath.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace E_Book +{ + internal static class MediaMath + { + public static decimal DimensionsMath(decimal pixelHeight, decimal pixelWidth) + { + return pixelHeight * (960 / pixelWidth); + } + } +} diff --git a/E-Book/Picture.cs b/E-Book/Picture.cs new file mode 100644 index 0000000..2a74895 --- /dev/null +++ b/E-Book/Picture.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace E_Book +{ + internal class Picture : MediaAssets + { + private decimal pixelWidth; + private decimal pixelHeight; + private decimal aspectraiton; + public Picture(decimal pixelHeight, decimal pixelWidth) + { + this.pixelHeight = pixelHeight; + this.pixelWidth = pixelWidth; + this.aspectraiton = MediaMath.DimensionsMath(this.pixelHeight,this.pixelWidth); + if (this.aspectraiton > 600) + { + this.pageCount = 1; + } + else + { + this.pageCount = 1 / 2; + } + } + + } +} diff --git a/E-Book/Program.cs b/E-Book/Program.cs new file mode 100644 index 0000000..93edb03 --- /dev/null +++ b/E-Book/Program.cs @@ -0,0 +1,19 @@ +namespace E_Book +{ + internal class Program + { + static void Main(string[] args) + { + MediaAssets text = new Texte(20); + MediaAssets video = new Video(20,49); + MediaAssets picture = new Picture(100, 200); + MediaAssets audio = new Audio(0); + EBook eBook = new EBook(50); + eBook.AddMediaAsset(text); + eBook.AddMediaAsset(video); + eBook.AddMediaAsset(picture); + eBook.AddMediaAsset(audio); + eBook.PrintInof(); + } + } +} \ No newline at end of file diff --git a/E-Book/Texte.cs b/E-Book/Texte.cs new file mode 100644 index 0000000..6e62877 --- /dev/null +++ b/E-Book/Texte.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace E_Book +{ + internal class Texte : MediaAssets + { + private decimal charCount; + public Texte(decimal charCount) + { + this.charCount = charCount; + this.pageCount = Math.Ceiling(charCount / 2000); + } + } +} diff --git a/E-Book/Video.cs b/E-Book/Video.cs new file mode 100644 index 0000000..9586baa --- /dev/null +++ b/E-Book/Video.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace E_Book +{ + internal class Video : MediaAssets + { + private decimal pixelWidth; + private decimal pixelHeight; + private decimal aspectraiton; + public Video(decimal pixelHeight, decimal pixelWidth) + { + this.pixelHeight = pixelHeight; + this.pixelWidth = pixelWidth; + this.aspectraiton = MediaMath.DimensionsMath(this.pixelHeight, this.pixelWidth); + if (this.aspectraiton > 600) + { + this.pageCount = 1; + } + else + { + this.pageCount = 1 / 2; + } + } + } +} diff --git a/EvenOrOddExtention/EvenOrOddExtention.csproj b/EvenOrOddExtention/EvenOrOddExtention.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/EvenOrOddExtention/EvenOrOddExtention.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/EvenOrOddExtention/Program.cs b/EvenOrOddExtention/Program.cs new file mode 100644 index 0000000..28670f4 --- /dev/null +++ b/EvenOrOddExtention/Program.cs @@ -0,0 +1,22 @@ +namespace EvenOrOddExtention +{ + internal class Program + { + static void Main(string[] args) + { + int input = 105; + Console.WriteLine(input.EvenOrOdd()); + } + } + static class EvenOrOddExtention + { + public static string EvenOrOdd(this int input) + { + if (input % 2 != 0) + { + return "Odd"; + } + return "Even"; + } + } +} \ No newline at end of file diff --git a/ExtensionMehtod2/Program.cs b/ExtensionMehtod2/Program.cs new file mode 100644 index 0000000..116b865 --- /dev/null +++ b/ExtensionMehtod2/Program.cs @@ -0,0 +1,24 @@ +namespace SplitWordIntoCountExtensionMethod +{ + internal class Program + { + static void Main(string[] args) + { + string input = "Das ist der Versuch nummer 1"; + Console.WriteLine($"Word count: {input.SplitIntoWords()}"); + } + } + static class WordCountExtension + { + public static int SplitIntoWords(this string input) + { + int freq = 0; + string[] index = input.Split(" "); + for (int i = 0; i < index.Length; i++) + { + freq++; + } + return freq; + } + } +} \ No newline at end of file diff --git a/ExtensionMehtod2/SplitWordIntoCountExtensionMethod.csproj b/ExtensionMehtod2/SplitWordIntoCountExtensionMethod.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/ExtensionMehtod2/SplitWordIntoCountExtensionMethod.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/ExtensionMethods/ExtensionMethods.csproj b/ExtensionMethods/ExtensionMethods.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/ExtensionMethods/ExtensionMethods.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/ExtensionMethods/Program.cs b/ExtensionMethods/Program.cs new file mode 100644 index 0000000..d03aa46 --- /dev/null +++ b/ExtensionMethods/Program.cs @@ -0,0 +1,27 @@ +using System.Text; + +namespace ExtensionMethods +{ + internal class Program + { + static void Main(string[] args) + { + string text = "Abra Kadabra"; + Console.WriteLine(text); + Console.WriteLine(text.SwitchCase()); + } + } + static class StringExtensions + { + public static string SwitchCase(this string s) + { + StringBuilder sb = new StringBuilder(); + foreach (char c in s) + { + sb.Append(char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c)); + } + return sb.ToString(); + } + } + +} \ No newline at end of file diff --git a/IBANNummerPrüfen/IBANNummerPrüfen.csproj b/IBANNummerPrüfen/IBANNummerPrüfen.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/IBANNummerPrüfen/IBANNummerPrüfen.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/IBANNummerPrüfen/IbanPrüfung.cs b/IBANNummerPrüfen/IbanPrüfung.cs new file mode 100644 index 0000000..7c2f177 --- /dev/null +++ b/IBANNummerPrüfen/IbanPrüfung.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IBANNummerPrüfen +{ + public class IbanPrüfung + { + // Richtiges IBAN Format: DE68 2105 0170 0012 3456 78 + //private string? IBAN; + private string? ibanCleared; + private string? ibanSwapped; + private string? sum; + private string? iban; + public void SetIbanPrüfungEntgegennehmen() + { + Console.Write("Bitte geben Sie ihre IBAN-Nummer ein: "); + this.iban = Console.ReadLine(); + + Console.WriteLine(IBANPrüfung()); + } + + /// + /// Bestimmt ob die Checksumme einer IBAN gültig ist + /// + /// Der zu prüfende IBAN (z.B: "DE68 2105 0170 0012 3456 78") + /// True, wenn gültig ist. Andernfalls False. + public bool IBANPrüfung() + { + if (this.iban != null) + { + this.ibanCleared = this.iban.ToUpper().Replace(" ", "").Replace("-", "").Replace(".", ""); + //Console.WriteLine(ibanCleared); + this.ibanSwapped = ibanCleared.Substring(4) + ibanCleared.Substring(0, 4); + //Console.WriteLine(ibanSwapped); + this.sum = ibanSwapped.Aggregate("", (current, c) => current + (char.IsLetter(c) ? (c - 55).ToString() : c.ToString())); + //Console.WriteLine(sum); + //this.sum = ibanCleared.Aggregate("", (current, c) => current + (char.IsLetter(c) ? (c - 55).ToString() : c.ToString())); + + var d = decimal.Parse(sum); + return ((d % 97) == 1); + } + return false; + } + + } +} diff --git a/IBANNummerPrüfen/Program.cs b/IBANNummerPrüfen/Program.cs new file mode 100644 index 0000000..dbf7576 --- /dev/null +++ b/IBANNummerPrüfen/Program.cs @@ -0,0 +1,11 @@ +namespace IBANNummerPrüfen +{ + internal class Program + { + static void Main(string[] args) + { + IbanPrüfung iban = new IbanPrüfung(); + iban.SetIbanPrüfungEntgegennehmen(); + } + } +} \ No newline at end of file diff --git a/KFZ/KFZ.csproj b/KFZ/KFZ.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/KFZ/KFZ.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/KFZ/Program.cs b/KFZ/Program.cs new file mode 100644 index 0000000..1114e01 --- /dev/null +++ b/KFZ/Program.cs @@ -0,0 +1,34 @@ +namespace KFZ +{ + internal class Program + { + static void Main(string[] args) + { + PKW p = new PKW(42); + } + } + class Fahrzeuge + { + private int id; + public Fahrzeuge() + { + Console.WriteLine("Fahrzeuge ohne Para"); + } + public Fahrzeuge(int id) + { + this.id = id; + Console.WriteLine("Fahrzeug mit Para"); + } + } + class PKW : Fahrzeuge + { + public PKW() + { + Console.WriteLine("Pkw ohne Para"); + } + public PKW(int id) : base(id) + { + Console.WriteLine("Pkw mit Para"); + } + } +} \ No newline at end of file diff --git a/Lohnabrechnung/Angestellter.cs b/Lohnabrechnung/Angestellter.cs new file mode 100644 index 0000000..092a205 --- /dev/null +++ b/Lohnabrechnung/Angestellter.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Lohnabrechnung +{ + internal class Angestellter : Lohnsklaven + { + private int alter; + private string? tarifgruppe; + public Angestellter(int alter, string? tarifgruppe, string? name, string? vorname) + { + this.alter = alter; + this.tarifgruppe = tarifgruppe; + this.name = name; + this.vorname = vorname; + hungerlohn(); + } + public void hungerlohn() + { + if (tarifgruppe == "A" || tarifgruppe == "a") + { + this.gehalt = 2560 * (1 + ((this.alter - 25.0) / 100)); + } + else if (tarifgruppe == "B" || tarifgruppe == "b") + { + this.gehalt = 3000 * (1 + ((this.alter - 25.0) / 100)); + } + else if (tarifgruppe == "C" || tarifgruppe == "c") + { + this.gehalt = 3200 * (1 + ((this.alter - 25.0) / 100)); + } + else if (tarifgruppe == "D" || tarifgruppe == "d") + { + this.gehalt = 5400 * (1 + ((this.alter - 25.0) / 100)); + } + } + + } +} diff --git a/Lohnabrechnung/ExternerMitarbeiter.cs b/Lohnabrechnung/ExternerMitarbeiter.cs new file mode 100644 index 0000000..4d2d9c1 --- /dev/null +++ b/Lohnabrechnung/ExternerMitarbeiter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Lohnabrechnung +{ + internal class ExternerMitarbeiter : Lohnsklaven + { + private int projektstunden; + + public ExternerMitarbeiter(int projektstunden, string? name, string? vorname) + { + this.projektstunden = projektstunden; + this.name = name; + this.vorname = vorname; + Berechnung(); + } + public void Berechnung() + { + this.gehalt = projektstunden * 75; + } + } +} diff --git a/Lohnabrechnung/Lohnabrechnung.csproj b/Lohnabrechnung/Lohnabrechnung.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Lohnabrechnung/Lohnabrechnung.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Lohnabrechnung/Lohnsklaven.cs b/Lohnabrechnung/Lohnsklaven.cs new file mode 100644 index 0000000..0a18e8e --- /dev/null +++ b/Lohnabrechnung/Lohnsklaven.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Lohnabrechnung +{ + internal class Lohnsklaven + { + protected string? name; + protected string? vorname; + protected double gehalt; + + public void DatenAusgabe() + { + if (this is Angestellter) + { + Console.WriteLine("Angestellter:"); + } + else if(this is ExternerMitarbeiter) + { + Console.WriteLine("Externer Mitarbeiter:"); + } + else if (this is Praktikant) + { + Console.WriteLine("Praktikant:"); + } + Console.WriteLine($"Name: {name}"); + Console.WriteLine($"Vorname: {vorname}"); + Console.WriteLine($"Gehalt: {gehalt:C2}"); + Console.WriteLine(); + } + } +} diff --git a/Lohnabrechnung/Praktikant.cs b/Lohnabrechnung/Praktikant.cs new file mode 100644 index 0000000..e17ea34 --- /dev/null +++ b/Lohnabrechnung/Praktikant.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Lohnabrechnung +{ + internal class Praktikant : Lohnsklaven + { + private string? abteilung; + public Praktikant(string? abteilung, string? name, string? vorname) + { + this.abteilung = abteilung; + this.name = name; + this.vorname = vorname; + fußabtreter(); + } + public void fußabtreter() + { + if (this.abteilung == "Entwicklung") + { this.gehalt = 935; } + else if (this.abteilung == "Vertreib") + { this.gehalt = 820; } + else if (this.abteilung == "Procuktion") + { this.gehalt = 710; } + } + } +} diff --git a/Lohnabrechnung/Program.cs b/Lohnabrechnung/Program.cs new file mode 100644 index 0000000..f903113 --- /dev/null +++ b/Lohnabrechnung/Program.cs @@ -0,0 +1,17 @@ +using System.Threading.Channels; + +namespace Lohnabrechnung +{ + internal class Program + { + static void Main(string[] args) + { + Angestellter angestellter1 = new Angestellter(31,"B","Goldfisch","Robertus"); + ExternerMitarbeiter externer = new ExternerMitarbeiter(900, "Lumpen", "Struppi"); + Praktikant prakti = new Praktikant("Entwicklung", "Gans", "Gustav"); + angestellter1.DatenAusgabe(); + externer.DatenAusgabe(); + prakti.DatenAusgabe(); + } + } +} \ No newline at end of file diff --git a/LohnabrechnungMusterlösung/Angstellter.cs b/LohnabrechnungMusterlösung/Angstellter.cs new file mode 100644 index 0000000..f45fa26 --- /dev/null +++ b/LohnabrechnungMusterlösung/Angstellter.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LohnabrechnungMusterlösung +{ + enum Tarigruppe + { + A, B, C, D + } + internal class Angstellter : Mitarbeiter + { + private int alter; + private Tarigruppe tarigruppe; + + public Angstellter(string? vorname, string? nachname, int alter, Tarigruppe tarigruppe) : base(vorname, nachname) + { + this.vorname = vorname; + this.nachname = nachname; + this.alter = alter; + this.tarigruppe = tarigruppe; + GehaltBerechnen(); + } + public void GehaltBerechnen() + { + double grundgehalt = 0; + switch (this.tarigruppe) + { + case Tarigruppe.A: + grundgehalt = 2560; + break; + case Tarigruppe.B: + grundgehalt = 3000; + break; + case Tarigruppe.C: + grundgehalt = 3200; + break; + case Tarigruppe.D: + grundgehalt = 5400; + break; + } + gehalt = grundgehalt * (1 + (alter - 25) / 100.0); + } + } +} diff --git a/LohnabrechnungMusterlösung/Department.cs b/LohnabrechnungMusterlösung/Department.cs new file mode 100644 index 0000000..07fff63 --- /dev/null +++ b/LohnabrechnungMusterlösung/Department.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LohnabrechnungMusterlösung +{ + internal class Department + { + protected string? bezeichnung; + protected double gehalt; + + public double GetGehalt() + { + return gehalt; + } + } + class Sales : Department + { + public Sales() + { + bezeichnung = "Vertrieb"; + gehalt = 820; + } + } + class Production : Department + { + public Production() + { + bezeichnung = "Produktion"; + } + } + class Development : Department + { + public Development() + { + bezeichnung = "Entwicklung"; + gehalt = 935; + } + } +} diff --git a/LohnabrechnungMusterlösung/ExternerMitarbeiter.cs b/LohnabrechnungMusterlösung/ExternerMitarbeiter.cs new file mode 100644 index 0000000..18a83c0 --- /dev/null +++ b/LohnabrechnungMusterlösung/ExternerMitarbeiter.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LohnabrechnungMusterlösung +{ + internal class ExternerMitarbeiter : Mitarbeiter + { + private int projektStunden; + private const int stundenLohn = 75; + + public ExternerMitarbeiter(string? vorname, string? nachname, int projektStunden) : base(vorname, nachname) + { + this.vorname = vorname; + this.nachname = nachname; + this.projektStunden = projektStunden; + GehaltBerechnung(); + } + public void GehaltBerechnung() + { + gehalt = projektStunden * stundenLohn; + } + } +} diff --git a/LohnabrechnungMusterlösung/LohnabrechnungMusterlösung.csproj b/LohnabrechnungMusterlösung/LohnabrechnungMusterlösung.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/LohnabrechnungMusterlösung/LohnabrechnungMusterlösung.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/LohnabrechnungMusterlösung/Mitarbeiter.cs b/LohnabrechnungMusterlösung/Mitarbeiter.cs new file mode 100644 index 0000000..4a91455 --- /dev/null +++ b/LohnabrechnungMusterlösung/Mitarbeiter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; + +namespace LohnabrechnungMusterlösung +{ + internal class Mitarbeiter + { + protected string? vorname; + protected string? nachname; + protected double gehalt; + + public Mitarbeiter(string? vorname, string? nachname) + { + this.vorname = vorname; + this.nachname = nachname; + } + public void DatenAusgabe() + { + Console.WriteLine($"Vorname: {this.vorname}"); + Console.WriteLine($"Nachname: {this.nachname}"); + Console.WriteLine($"Gehalt: {this.gehalt:C2}"); + } + } +} diff --git a/LohnabrechnungMusterlösung/Praktikant.cs b/LohnabrechnungMusterlösung/Praktikant.cs new file mode 100644 index 0000000..b815239 --- /dev/null +++ b/LohnabrechnungMusterlösung/Praktikant.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LohnabrechnungMusterlösung +{ + internal class Praktikant : Mitarbeiter + { + private Department abteilung; + + public Praktikant(string? vorname, string? nachname, Department abteilung) : base(vorname, nachname) + { + this.vorname = vorname; + this.nachname = nachname; + this.abteilung = abteilung; + GehaltBerechnen(); + } + public void GehaltBerechnen() + { + this.gehalt = abteilung.GetGehalt(); + } + } +} diff --git a/LohnabrechnungMusterlösung/Program.cs b/LohnabrechnungMusterlösung/Program.cs new file mode 100644 index 0000000..ecba287 --- /dev/null +++ b/LohnabrechnungMusterlösung/Program.cs @@ -0,0 +1,20 @@ +using System.Runtime.CompilerServices; + +namespace LohnabrechnungMusterlösung +{ + internal class Program + { + static void Main(string[] args) + { + Mitarbeiter[] mitarbeiter = new Mitarbeiter[3]; + mitarbeiter[0] = new ExternerMitarbeiter("Harry", "Potter", 135); + mitarbeiter[1] = new Praktikant("Newt", "Scamander", new Development()); + mitarbeiter[2] = new Angstellter("Lord", "Voldemort", 71, Tarigruppe.D); + + foreach (var item in mitarbeiter) + { + item.DatenAusgabe(); + } + } + } +} \ No newline at end of file diff --git a/Moped/MitAnhänger.cs b/Moped/MitAnhänger.cs new file mode 100644 index 0000000..c90363a --- /dev/null +++ b/Moped/MitAnhänger.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Moped +{ + internal class MitAnhänger : Moped + { + private int maxLoad; + private int currentLoad; + + //public MitAnhänger(int kilometerstand, bool isSportModel, int maxLadeFläche) : base( kilometerstand, isSportModel) + //{ + // this.licencePlate = "BIT-LC 1"; + // this.odometer = kilometerstand; + // this.seats = 2; + // this.maxLadeFläche = maxLadeFläche; + //} + //public MitAnhänger(string kennzeichen, int kilometerstand, bool isSportModel, int maxLadeFläche) : base(kennzeichen, kilometerstand, isSportModel) + //{ + // this.licencePlate = kennzeichen; + // this.odometer = kilometerstand; + // this.seats = 2; + // this.maxLadeFläche = maxLadeFläche; + //} + public MitAnhänger() : this(10, "BIT-LC 1") { } + public MitAnhänger(string licencePlate) : this(10, licencePlate) { } + public MitAnhänger(int maxLoad) : this(maxLoad, "BIT-LC 1") { } + public MitAnhänger(int maxLoad, string licencePlate) : base(licencePlate) + { + this.maxLoad = maxLoad; + } + public bool Load(int x) + { + if (x >= 0 && this.currentLoad + x <= this.maxLoad) + { + this.currentLoad += x; + Console.WriteLine($"Es wurden {x} Dinge aufgeladen."); + return true; + } + else + { + Console.WriteLine($"Es ist nicht genug Platz für {x} Dinge."); + return false; + } + } + public bool Unload(int x) + { + if (x >= 0 && this.currentLoad >= x) + { + this.currentLoad -= x; + Console.WriteLine($"Es wurden {x} Dinge abgeladen."); + return true; + } + else + { + Console.WriteLine($"Es sind keine {x} Dinge vorhanden."); + return false; + } + } + public int GetLoad() + { + return currentLoad; + } + //public override void GetInfos() + //{ + // base.GetInfos(); + // Console.WriteLine($"Die ladung des Anhängers beträgt {GetLoad()}"); + // Console.WriteLine(); + //} + public override void GetInfos() + { + base.GetInfos(); + Console.WriteLine($"Ladefläche: {currentLoad}"); + Console.WriteLine($"Ladefläche max: {maxLoad}"); + } + } +} diff --git a/Moped/Moped.cs b/Moped/Moped.cs new file mode 100644 index 0000000..5e6124e --- /dev/null +++ b/Moped/Moped.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Moped +{ + internal class Moped + { + protected string licencePlate; + protected int odometer; + protected int seats; + + public Moped() : this("Bit-LC 1", false) { } + public Moped(bool IsSportModel) : this("BIT-LC 1", IsSportModel) { } + public Moped(string licenePlate) : this(licenePlate, false) { } + public Moped(string licencePlate, bool IsSportModel) + { + this.licencePlate = licencePlate; + this.seats = IsSportModel ? 1 : 0; + } + //public Moped(int kilometerstand, bool isSportModel) + //{ + // this.licencePlate = "BIT-LC 1"; + // this.odometer = kilometerstand; + // this.seats = isSportModel ? 1 : 2; + //} + //public Moped(string kennzeichen, int kilometerstand, bool isSportModel) + //{ + // this.licencePlate = kennzeichen; + // this.odometer = kilometerstand; + // this.seats = isSportModel ? 1 : 2; + //} + + public void Drive(int x) + { + this.odometer += x; + Console.WriteLine($"Das Moped fährt {x} Kilometer."); + } + public string GetLicensePlatte() + { + return this.licencePlate; + } + public int GetOdometer() + { + return this.odometer; + } + public int GetSeats() + { + if (seats == 1) + { + return this.seats = 1; + } + else + { + return this.seats = 2; + } + } + public virtual void GetInfos() + { + Console.WriteLine($"Kennzeichen: {GetLicensePlatte()}"); + Console.WriteLine($"Kilometer: {GetOdometer()}"); + Console.WriteLine($"Sitzsplätze: {GetSeats()}"); + } + //public virtual void GetInfos() + //{ + // Console.WriteLine($"Das Moped hat folgendes Kennzeichen:{licencePlate}"); + // Console.WriteLine($"Das Moped hat folgenden Kilometerstand:{odometer}"); + // if (this.seats == 1) + // { + // Console.WriteLine($"Sport Moped hat nur 1 Sitzsplatz"); + // } + // else + // { + // Console.WriteLine($"Normale Mopeds haben 2 Sitzpätze"); + // } + //} + } +} diff --git a/Moped/Moped.csproj b/Moped/Moped.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Moped/Moped.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Moped/Program.cs b/Moped/Program.cs new file mode 100644 index 0000000..ddf8ef8 --- /dev/null +++ b/Moped/Program.cs @@ -0,0 +1,45 @@ +namespace Moped +{ + internal class Program + { + static void Main(string[] args) + { + //Moped m1 = new Moped(200, 0); + //Moped m2 = new Moped("UN DO : 022",200, 1); + //MitAnhänger ma1 = new MitAnhänger(200,2,30); + //m1.Drive(50); + //m1.GetInfos(); + //Console.WriteLine(); + //ma1.GetInfos(); + //ma1.Load(15); + //ma1.GetInfos(); + //ma1.Unload(4); + //ma1.GetInfos(); + Moped[] mopeds = new Moped[4]; + mopeds[0] = new Moped(); + mopeds[1] = new Moped("xyz"); + mopeds[2] = new Moped(true); + mopeds[3] = new Moped("ABC", true); + + //mopeds[2].Drive(50); + //mopeds[0].Drive(100); + + foreach (var item in mopeds) + { + item.GetInfos(); + Console.WriteLine(); + } + + MitAnhänger ma1 = new MitAnhänger(100,"UN-IT 4666"); + ma1.GetInfos(); + Console.WriteLine(); + + mopeds[3] = ma1; + foreach (var item in mopeds) + { + item.GetInfos(); + Console.WriteLine(); + } + } + } +} \ No newline at end of file diff --git a/Palindrom/IsPalindrom.cs b/Palindrom/IsPalindrom.cs new file mode 100644 index 0000000..5ee5be7 --- /dev/null +++ b/Palindrom/IsPalindrom.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Palindrom +{ + internal class IsPalindrom + { + private string _text; + public bool IstDasEinPalindrom(string text) + { + this._text = text.ToLower(); + this._text = text.Replace(" ", ""); + + for (int i = text.Length - 1; i < 0; i--) + { + this._text.Append(text[i]); + } + if (this._text == text) + { + return true; + } + return false; + } + } +} diff --git a/Palindrom/Palindrom.csproj b/Palindrom/Palindrom.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Palindrom/Palindrom.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Palindrom/Program.cs b/Palindrom/Program.cs new file mode 100644 index 0000000..5afbd66 --- /dev/null +++ b/Palindrom/Program.cs @@ -0,0 +1,14 @@ +using System.Threading.Channels; + +namespace Palindrom +{ + internal class Program + { + static void Main(string[] args) + { + IsPalindrom palindrom = new IsPalindrom(); + string x = Console.ReadLine(); + Console.WriteLine(palindrom.IstDasEinPalindrom(x)); + } + } +} \ No newline at end of file diff --git a/PalindromeExtention/PalindromeExtention.csproj b/PalindromeExtention/PalindromeExtention.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/PalindromeExtention/PalindromeExtention.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/PalindromeExtention/Program.cs b/PalindromeExtention/Program.cs new file mode 100644 index 0000000..4a28313 --- /dev/null +++ b/PalindromeExtention/Program.cs @@ -0,0 +1,26 @@ +namespace PalindromeExtention +{ + internal class Program + { + static void Main(string[] args) + { + string input = "otto"; + Console.WriteLine(input.Palindrom()); + } + } + static class PalindormExtention + { + public static bool Palindrom(this string input) + { + string index = input.Replace(" ","").ToLower(); + for (int i = 0; i < index.Length / 2; i++) + { + if (index[i] != index[index.Length - i - 1]) + { + return false; + } + } + return true; + } + } +} \ No newline at end of file diff --git a/Parkplatz/Auto.cs b/Parkplatz/Auto.cs new file mode 100644 index 0000000..c366e73 --- /dev/null +++ b/Parkplatz/Auto.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Parkplatz +{ + internal class Auto + { + private string kennzeichen; + + public Auto(string kennzeichen) + { + this.kennzeichen = kennzeichen; + } + public string GetKennzeichen() + { + return kennzeichen; + } + } +} diff --git a/Parkplatz/Parkboxen.cs b/Parkplatz/Parkboxen.cs new file mode 100644 index 0000000..8c43202 --- /dev/null +++ b/Parkplatz/Parkboxen.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Parkplatz +{ + internal class Parkboxen + { + private Auto? auto; + + public bool einparken(Auto auto) + { + if (this.auto == null) + { + this.auto = auto; + return true; + } + else return false; + } + public Auto ausparken(string kennzeichen) + { + if (this.auto.GetKennzeichen() == kennzeichen) + { + Auto h = this.auto; + this.auto = null; + return h; + } + else return null; + } + public bool istleer() { return this.auto == null; } + + } +} diff --git a/Parkplatz/Parkplatz.cs b/Parkplatz/Parkplatz.cs new file mode 100644 index 0000000..6c46aa3 --- /dev/null +++ b/Parkplatz/Parkplatz.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Parkplatz +{ + internal class Parkplatz + { + private int anzahlParkboxen; + private Parkboxen[] parkboxen; + public Parkplatz(int anzahlParkboxen) + { + this.anzahlParkboxen = anzahlParkboxen; + this.parkboxen = new Parkboxen[anzahlParkboxen]; + for (int i = 0; i < parkboxen.Length; i++) + { + this.parkboxen[i] = new Parkboxen(); + } + } + + public bool parken(Auto auto) + { + for (int i = 0; i < parkboxen.Length; i++) + { + if (parkboxen[i].einparken(auto)) + { + return true; + } + } + return false; + } + public Auto ausparken(string kennzeichen) + { + for (int i = 0; i < anzahlParkboxen; i++) + { + Auto a = parkboxen[i].ausparken(kennzeichen); + if (a != null) + { + return a; + } + } + return null; + } + public void status() + { + Console.WriteLine("Parkplatz-Status: "); + for (int i = 0; i < anzahlParkboxen; i++) + { + if (parkboxen[i].istleer()) + { + Console.Write("[ ]"); + } + else Console.Write("[X]"); + + } + Console.WriteLine(); + } + } +} diff --git a/Parkplatz/Parkplatz.csproj b/Parkplatz/Parkplatz.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Parkplatz/Parkplatz.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Parkplatz/Program.cs b/Parkplatz/Program.cs new file mode 100644 index 0000000..7d810f6 --- /dev/null +++ b/Parkplatz/Program.cs @@ -0,0 +1,32 @@ +namespace Parkplatz +{ + internal class Program + { + static void Main(string[] args) + { + Parkplatz parkplatz = new Parkplatz(100); + + Auto auto1 = new Auto("ABC-123"); + Auto auto2 = new Auto("DEF-456"); + Auto auto3 = new Auto("GHI-789"); + Auto auto4 = new Auto("IJK-101"); + Auto auto5 = new Auto("LMN-102"); + Auto auto6 = new Auto("OPQ-103"); + Auto auto7 = new Auto("RST-104"); + Auto auto8 = new Auto("UVW-105"); + Auto auto9 = new Auto("XYZ-106"); + + parkplatz.status(); + Console.WriteLine(); + parkplatz.parken(auto1); + parkplatz.parken(auto2); + parkplatz.parken(auto3); + parkplatz.parken(auto4); + parkplatz.status(); + parkplatz.ausparken("DEF-456"); + parkplatz.status(); + + Console.ReadKey(); + } + } +} \ No newline at end of file diff --git a/Parkplatz2/Auto.cs b/Parkplatz2/Auto.cs new file mode 100644 index 0000000..3217b20 --- /dev/null +++ b/Parkplatz2/Auto.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Parkplatz2 +{ + class Auto + { + private string kennzeichen; + + public Auto(string kennzeichen) + { + this.kennzeichen = kennzeichen; + } + public string GetKennzeichen() + { + return kennzeichen; + } + } +} diff --git a/Parkplatz2/Parkbox.cs b/Parkplatz2/Parkbox.cs new file mode 100644 index 0000000..3acef10 --- /dev/null +++ b/Parkplatz2/Parkbox.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Parkplatz2 +{ + class Parkbox + { + private int id; + private Auto auto; + + public Parkbox(int id) + { + this.id = id; + } + public int GetId() + { + return id; + } + public bool IstLeer() + { + return auto == null; + } + public bool Einparken(Auto auto) + { + if (IstLeer()) + { + this.auto = auto; + return true; + } + return false; + } + public Auto Ausparken(string kennzeichen) + { + if (!IstLeer()) + { + if (kennzeichen == auto.GetKennzeichen()) + { + Auto help = auto; + auto = null; + return help; + } + } + return null; + } + } +} diff --git a/Parkplatz2/Parkplatz.cs b/Parkplatz2/Parkplatz.cs new file mode 100644 index 0000000..e73c1da --- /dev/null +++ b/Parkplatz2/Parkplatz.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Parkplatz2 +{ + internal class Parkplatz + { + private int id; + private Parkbox[] parkboxen; + //private Parkschein parkschein; + + public Parkplatz(int id, int anzahl) + { + this.id = id; + this.parkboxen = new Parkbox[anzahl]; + for (int i = 0; i < this.parkboxen.Length; i++) + { + this.parkboxen[i] = new Parkbox(i); + } + } + public int GetId() + { return this.id; } + public int FreiePlätze() + { + int anzahl = 0; + for (int i = 0; i < this.parkboxen.Length; i++) + { + if (this.parkboxen[i].IstLeer()) + { + anzahl++; + } + } + return anzahl; + } + public Parkschein Einparken(Auto auto) + { + for (int i = 0; i < this.parkboxen.Length; i++) + { + if (this.parkboxen[i].IstLeer()) + { + if (this.parkboxen[i].Einparken(auto)) + { + Parkschein ps = new Parkschein(this.id, parkboxen[i].GetId(),auto.GetKennzeichen()); + Console.WriteLine($"Das Auto wurde in {this.parkboxen[i].GetId()} eingeparkt."); + return ps; + } + } + } + Console.WriteLine("Das Auto konnte nicht eingeparkt werden."); + return null; + } + public Auto Ausparken(Parkschein ps) + { + if (ps.GetParkplatzId() == this.id) + { + for (int i = 0; i < this.parkboxen.Length; i++) + { + if (ps.GetParboxId() == this.parkboxen[i].GetId()) + { + Auto rückgabe = this.parkboxen[i].Ausparken(ps.GetKennzeichen()); + if (rückgabe != null) + { + Console.WriteLine($"Das Auto wurde aus PB {this.parkboxen[i].GetId()} ausgeparkt."); + return rückgabe; + } + } + } + } + Console.WriteLine("Auto konnte nicht ausgeparkt werden. Es existiert nicht"); + return null; + } + } +} diff --git a/Parkplatz2/Parkplatz2.csproj b/Parkplatz2/Parkplatz2.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Parkplatz2/Parkplatz2.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Parkplatz2/Parkschein.cs b/Parkplatz2/Parkschein.cs new file mode 100644 index 0000000..c9dffd6 --- /dev/null +++ b/Parkplatz2/Parkschein.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace Parkplatz2 +{ + internal class Parkschein + { + private int parkboxId; + private int parkplatzId; + private string kennzeichen; + public Parkschein (int parkplatzId, int parkboxId, string kennzeichen) + { + + this.parkboxId = parkboxId; + this.kennzeichen = kennzeichen; + this.parkplatzId = parkplatzId; + } + + public string GetKennzeichen() + { + return this.kennzeichen; + } + public int GetParkplatzId() + { + return this.parkplatzId; + } + public int GetParboxId() + { + return this.parkboxId; + } + } +} diff --git a/Parkplatz2/Program.cs b/Parkplatz2/Program.cs new file mode 100644 index 0000000..a4fd730 --- /dev/null +++ b/Parkplatz2/Program.cs @@ -0,0 +1,32 @@ +using System; + +namespace Parkplatz2 +{ + class Program + { + static void Main(string[] args) + { + Auto a1 = new Auto("UN-IT 4666"); + Auto a2 = new Auto("UN-IT 92"); + Auto a3 = new Auto("UN-IT 91"); + Auto a4 = new Auto("UN-IT 7666"); + Auto a5 = new Auto("UN-IT 6666"); + Auto a6 = new Auto("UN-IT 5666"); + + Parkplatz p1 = new Parkplatz(1, 5); + Console.WriteLine("Freie Plätze: " + p1.FreiePlätze()); + + Parkschein ps1 = p1.Einparken(a1); + Console.WriteLine(ps1.GetParkplatzId()); + Console.WriteLine(ps1.GetParboxId()); + Console.WriteLine(ps1.GetKennzeichen()); + Console.WriteLine(); + + a1 = null; + + a1 = p1.Ausparken(ps1); + Console.WriteLine(a1.GetKennzeichen()); + } + } +} + \ No newline at end of file diff --git a/Simpsons/Bart.cs b/Simpsons/Bart.cs new file mode 100644 index 0000000..db6c097 --- /dev/null +++ b/Simpsons/Bart.cs @@ -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."); + } + } +} diff --git a/Simpsons/Familie.cs b/Simpsons/Familie.cs new file mode 100644 index 0000000..8c53f07 --- /dev/null +++ b/Simpsons/Familie.cs @@ -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}"); + } + } +} diff --git a/Simpsons/Homer.cs b/Simpsons/Homer.cs new file mode 100644 index 0000000..beee010 --- /dev/null +++ b/Simpsons/Homer.cs @@ -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."); + } + } +} diff --git a/Simpsons/Lisa.cs b/Simpsons/Lisa.cs new file mode 100644 index 0000000..d1a4dfe --- /dev/null +++ b/Simpsons/Lisa.cs @@ -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."); + } + } +} diff --git a/Simpsons/Maggie.cs b/Simpsons/Maggie.cs new file mode 100644 index 0000000..c5174c7 --- /dev/null +++ b/Simpsons/Maggie.cs @@ -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."); + } + } +} diff --git a/Simpsons/Marge.cs b/Simpsons/Marge.cs new file mode 100644 index 0000000..7d82196 --- /dev/null +++ b/Simpsons/Marge.cs @@ -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."); + } + } +} diff --git a/Simpsons/Program.cs b/Simpsons/Program.cs new file mode 100644 index 0000000..56d30ba --- /dev/null +++ b/Simpsons/Program.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/Simpsons/Simpsons.csproj b/Simpsons/Simpsons.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Simpsons/Simpsons.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/SpielAutomat/Automat.cs b/SpielAutomat/Automat.cs new file mode 100644 index 0000000..4c99984 --- /dev/null +++ b/SpielAutomat/Automat.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SpielAutomat +{ + internal class Automat + { + } +} diff --git a/SpielAutomat/Program.cs b/SpielAutomat/Program.cs new file mode 100644 index 0000000..3287e76 --- /dev/null +++ b/SpielAutomat/Program.cs @@ -0,0 +1,10 @@ +namespace SpielAutomat +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } + } +} \ No newline at end of file diff --git a/SpielAutomat/SpielAutomat.csproj b/SpielAutomat/SpielAutomat.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/SpielAutomat/SpielAutomat.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/SplitCharsIntoCountExtentions/Program.cs b/SplitCharsIntoCountExtentions/Program.cs new file mode 100644 index 0000000..cbf9f98 --- /dev/null +++ b/SplitCharsIntoCountExtentions/Program.cs @@ -0,0 +1,28 @@ +using System.Diagnostics.Metrics; + +namespace SplitCharsIntoCountExtentions +{ + internal class Program + { + static void Main(string[] args) + { + string input = "a"; + Console.WriteLine($"Word count: {input.CharCount('a')}"); + } + } + static class CharCountExtension + { + public static int CharCount(this string input, char letter) + { + int counter = 0; + foreach (var item in input) + { + if (item == letter) + { + counter++; + } + } + return counter; + } + } +} \ No newline at end of file diff --git a/SplitCharsIntoCountExtentions/SplitCharsIntoCountExtentions.csproj b/SplitCharsIntoCountExtentions/SplitCharsIntoCountExtentions.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/SplitCharsIntoCountExtentions/SplitCharsIntoCountExtentions.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/SplitSentencesIntoCountExtentions/Program.cs b/SplitSentencesIntoCountExtentions/Program.cs new file mode 100644 index 0000000..cb60fec --- /dev/null +++ b/SplitSentencesIntoCountExtentions/Program.cs @@ -0,0 +1,26 @@ +using System.Runtime.CompilerServices; + +namespace SplitSentencesIntoCountExtentions +{ + internal class Program + { + static void Main(string[] args) + { + string input = "Das ist der Versuch nummer 1. Aber das Sagt ja nichts aus selbst wenn es Funktioniert"; + Console.WriteLine($"Word count: {input.SentenceCount()}"); + } + } + static class SentencesIntoCount + { + public static int SentenceCount(this string input) + { + int freq = 0; + string[] index = input.Split("."); + for (int i = 0; i < index.Length; i++) + { + freq++; + } + return freq; + } + } +} \ No newline at end of file diff --git a/SplitSentencesIntoCountExtentions/SplitSentencesIntoCountExtentions.csproj b/SplitSentencesIntoCountExtentions/SplitSentencesIntoCountExtentions.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/SplitSentencesIntoCountExtentions/SplitSentencesIntoCountExtentions.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/StringCountExtention/Program.cs b/StringCountExtention/Program.cs new file mode 100644 index 0000000..70dde93 --- /dev/null +++ b/StringCountExtention/Program.cs @@ -0,0 +1,26 @@ +using System.Runtime.CompilerServices; + +namespace StringCountExtention +{ + internal class Program + { + static void Main(string[] args) + { + string input = "Hello World!"; + Console.WriteLine($"{input.LeftStringCount(5)}"); + Console.WriteLine($"{input.RightStringCount(6)}"); + } + } + static class StringCountExtention + { + public static string LeftStringCount(this string input, int frqen) + { + return input.Substring(0, frqen); + } + public static string RightStringCount(this string input, int frqen) + { + return input.Substring(frqen); + } + } + +} \ No newline at end of file diff --git a/StringCountExtention/StringCountExtention.csproj b/StringCountExtention/StringCountExtention.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/StringCountExtention/StringCountExtention.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Stringaufgabe1/CharString.cs b/Stringaufgabe1/CharString.cs new file mode 100644 index 0000000..a8ff9d9 --- /dev/null +++ b/Stringaufgabe1/CharString.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Intrinsics.X86; +using System.Text; +using System.Threading.Tasks; + +namespace Stringaufgabe1 +{ + internal class CharString + { + private string? _string; + private int _index; + public int CountCharInString(string s, char c) + { + this._string = s; + this._index = _string.Split(c).Length -1; + return _index; + } + public void PrintInfo() + { + Console.WriteLine($"Vorkommende Anzahl: {this._index}"); + } + } +} diff --git a/Stringaufgabe1/Program.cs b/Stringaufgabe1/Program.cs new file mode 100644 index 0000000..b5ecec5 --- /dev/null +++ b/Stringaufgabe1/Program.cs @@ -0,0 +1,13 @@ +namespace Stringaufgabe1 +{ + internal class Program + { + static void Main(string[] args) + { + CharString charString = new CharString(); + Console.WriteLine("Geben Sie ihren Text ein und dann nach dem buchstaben den Sie zählen wollen: "); + charString.CountCharInString(Console.ReadLine(),Convert.ToChar(Console.ReadLine())); + charString.PrintInfo(); + } + } +} \ No newline at end of file diff --git a/Stringaufgabe1/Stringaufgabe1.csproj b/Stringaufgabe1/Stringaufgabe1.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Stringaufgabe1/Stringaufgabe1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Stringaufgabe2/Analyse.cs b/Stringaufgabe2/Analyse.cs new file mode 100644 index 0000000..160d5e1 --- /dev/null +++ b/Stringaufgabe2/Analyse.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Channels; +using System.Threading.Tasks; + +namespace Stringaufgabe2 +{ + internal class Analyse + { + private string? _string; + private char[] konsonant = new char[] { 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z' }; + private char[] umlaut = new char[] { 'ä', 'ö', 'ü', 'ß' }; + private char[] vokal = new char[] { 'a', 'e', 'i', 'o', 'u' }; + private char[] zeichen = new char[] { '.',',',';',':','-','*','#', '+','?','`','´','^','%','!' }; + private char[] zahlen = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; + private int _vokal; + private int _konsonant; + private int _umlaut; + private int _zeichen; + private int _zahlen; + private int _rest; + public void AnalyseString(string s) + { + this._string = s.ToLower(); + for (int i = 0; i < _string.Length; i++) + { + if (vokal.Contains(_string[i])) + { + _vokal++; + } + else if (umlaut.Contains(_string[i])) + { + _umlaut++; + } + else if (konsonant.Contains(_string[i])) + { + _konsonant++; + } + else if (zeichen.Contains(_string[i])) + { + _zeichen++; + } + else if (zahlen.Contains(_string[i])) + { + _zahlen++; + } + else + { + _rest++; + } + } + Console.WriteLine($"Der Text hat: {_konsonant} Konsonante"); + Console.WriteLine($" {_vokal} Vokale"); + Console.WriteLine($" {_umlaut} Umlaute"); + Console.WriteLine($" {_zeichen} Zeichen"); + Console.WriteLine($" {_zahlen} Zahlen"); + Console.WriteLine($" {_rest} Leerzeichen"); + } + } +} diff --git a/Stringaufgabe2/Program.cs b/Stringaufgabe2/Program.cs new file mode 100644 index 0000000..4ed11d8 --- /dev/null +++ b/Stringaufgabe2/Program.cs @@ -0,0 +1,12 @@ +namespace Stringaufgabe2 +{ + internal class Program + { + static void Main(string[] args) + { + Analyse analyse = new Analyse(); + Console.WriteLine("Geben Sie den zu Prüfenden Text ein: "); + analyse.AnalyseString(Console.ReadLine()); + } + } +} \ No newline at end of file diff --git a/Stringaufgabe2/Stringaufgabe2.csproj b/Stringaufgabe2/Stringaufgabe2.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Stringaufgabe2/Stringaufgabe2.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/StudentenDatenbank/Datenbank.cs b/StudentenDatenbank/Datenbank.cs new file mode 100644 index 0000000..0349731 --- /dev/null +++ b/StudentenDatenbank/Datenbank.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Intrinsics.X86; +using System.Text; +using System.Threading.Tasks; + +namespace StudentenDatenbank +{ + internal class Datenbank + { + private Student[] studenten; + + public Datenbank(int anzahl) + { + studenten = new Student[anzahl]; + } + public bool AddStudent(Student student) + { + for (int i = 0; i < studenten.Length; i++) + { + if (studenten[i] == null) + { + studenten[i] = student; + return true; + } + } + return false; + } + public bool RemoveStudent(Student student) + { + for (int i = 0; i < studenten.Length; i++) + { + if (studenten[i] == student) + { + studenten[i] = null; + return true; + } + } + return false; + } + public bool RemoveStudent (int martrieklNr) + { + for (int i = 0; i < studenten.Length; i++) + { + if (studenten[i] != null) + { + if (studenten[i].GetMatrikelNr() == martrieklNr) + { + studenten[i] = null; + return true; + } + } + } + return false; + } + public int CountStudents() + { + int cnt = 0; + for (int i = 0; i < studenten.Length; i++) + { + if (studenten[i] != null) + { + cnt++; + } + } + return cnt; + } + public void PrintMe() + { + for (int i = 0; i < studenten.Length; i++) + { + if (studenten[i] != null) + { + studenten[i].PrintMe(); + } + } + } + } +} diff --git a/StudentenDatenbank/Program.cs b/StudentenDatenbank/Program.cs new file mode 100644 index 0000000..28a4ebb --- /dev/null +++ b/StudentenDatenbank/Program.cs @@ -0,0 +1,32 @@ +namespace StudentenDatenbank +{ + internal class Program + { + static void Main(string[] args) + { + Student s1 = new Student(1, "Max", "Informatik"); + Student s2 = new Student(2, "Dörte", "Mathematik"); + Student s3 = new Student(3, "Udo", "Agrartechnik"); + Student s4 = new Student(4, "Sibille", "Architecktur"); + + Datenbank db = new Datenbank(5); + + db.AddStudent(s1); + db.PrintMe(); + Console.WriteLine(); + + db.AddStudent(s2); + db.AddStudent(s3); + db.PrintMe(); + Console.WriteLine(); + + db.RemoveStudent(s2); + db.PrintMe(); + Console.WriteLine(); + + db.RemoveStudent(1); + db.PrintMe(); + } + + } +} \ No newline at end of file diff --git a/StudentenDatenbank/Student.cs b/StudentenDatenbank/Student.cs new file mode 100644 index 0000000..231083e --- /dev/null +++ b/StudentenDatenbank/Student.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentenDatenbank +{ + internal class Student + { + private int matrikelNr; + private string? name; + private string? fachrichtung; + + public Student(int matrikelNr, string? name, string? fachrichtung) + { + this.matrikelNr = matrikelNr; + this.name = name; + this.fachrichtung = fachrichtung; + } + public int GetMatrikelNr() { return this.matrikelNr; } + public string? GetName() { return this.name; } + public string? GetFachrichtung() { return this.fachrichtung; } + + public void PrintMe() + { + Console.WriteLine($"Matrikel-Nr.: {this.matrikelNr}"); + Console.WriteLine($"Name: {this.name}"); + Console.WriteLine($"Fachrichtung: {this.fachrichtung}"); + } + } +} diff --git a/StudentenDatenbank/StudentenDatenbank.csproj b/StudentenDatenbank/StudentenDatenbank.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/StudentenDatenbank/StudentenDatenbank.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/TvSteuerung/Program.cs b/TvSteuerung/Program.cs new file mode 100644 index 0000000..af027e0 --- /dev/null +++ b/TvSteuerung/Program.cs @@ -0,0 +1,29 @@ +namespace TvSteuerung +{ + internal class Program + { + static void Main(string[] args) + { + TV tvstatus = new TV(); + Console.Write("Tv status: "); + tvstatus.SetSwitchedOn(Console.ReadLine()); + tvstatus.GetInfostatus(); + + Console.Write("Programm auswählen: "); + tvstatus.SetChannel(Console.ReadLine()); + tvstatus.GetInfoChannel(); + + Console.Write("Lautstärke: "); + tvstatus.SetVolume(Convert.ToInt16(Console.ReadLine())); + tvstatus.GetInfoVolum(); + + Console.Write("Lauter: "); + tvstatus.SetRaiseVolume(Console.ReadLine()); + tvstatus.GetInfoVolum(); + + Console.Write("leiser: "); + tvstatus.SetLowerVolume(Console.ReadLine()); + tvstatus.GetInfoVolum(); + } + } +} \ No newline at end of file diff --git a/TvSteuerung/TV.cs b/TvSteuerung/TV.cs new file mode 100644 index 0000000..99a5a71 --- /dev/null +++ b/TvSteuerung/TV.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.Design; +using System.Linq; +using System.Text; +using System.Threading.Channels; +using System.Threading.Tasks; + +namespace TvSteuerung +{ + internal class TV + { + private bool switchedOn; + private int volume; + private string? channel; + + //*set-volumen** + public void SetVolume(int volumen) + { this.volume = volumen; } + public string GetVolume() + { + if (volume == 0) { return "ton aus"; } + else if (volume > 1 && volume <= 9) { return "1%"; } + else if (volume > 9 && volume <= 19) { return "10%"; } + else if (volume > 19 && volume <= 29) { return "20%"; } + else if (volume > 29 && volume <= 39) { return "30%"; } + else if (volume > 39 && volume <= 49) { return "40%"; } + else if (volume > 49 && volume <= 59) { return "50%"; } + else if (volume > 59 && volume <= 69) { return "60%"; } + else if (volume > 69 && volume <= 79) { return "70%"; } + else if (volume > 79 && volume <= 89) { return "80%"; } + else if (volume > 89 && volume <= 99) { return "90%"; } + else return "100%"; + } + //**volum-raise/-lower** + public void SetRaiseVolume(string volumen) + { + if (volumen == "+" && volume <=90 ) { volume += 10; } + } + public void SetLowerVolume(string volumen) + { + if (volumen == "-" ) { volume -= 10; } + } + //**power-on/-off** + public void SetSwitchedOn(string switchedOn) + { + if (switchedOn == "an") { this.switchedOn = true; } + else this.switchedOn = false; + } + public string GetSwitchedOn() + { + if (switchedOn == true) { return "an"; } + else return "aus"; + } + //**channel-surfing** + public void SetChannel(string channel) + { this.channel = channel; } + public string GetChannel() + { + if (channel == "1") { return "Das Erste"; } + else if (channel == "2") { return "Das Zweite"; } + else if (channel == "3") { return "Das Dritte"; } + else if (channel == "4") { return "rtl"; } + else if (channel == "5") { return "sat1"; } + else if (channel == "6") { return "rtl2"; } + else if (channel == "7") { return "ProSieben"; } + else return "tv wird ausgeschaltet läuft sowieso nichts gutes."; + } + //**info-printing** + public void GetInfostatus() + { + Console.WriteLine($"Fernseher: {GetSwitchedOn()}"); + } + public void GetInfoChannel() + { + Console.WriteLine($"Channel: {GetChannel()}"); + } + public void GetInfoVolum() + { + Console.WriteLine($"Lautstärke {GetVolume()}"); + } + } +} diff --git a/TvSteuerung/TvSteuerung.csproj b/TvSteuerung/TvSteuerung.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/TvSteuerung/TvSteuerung.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/UmlautsExtentions/Program.cs b/UmlautsExtentions/Program.cs new file mode 100644 index 0000000..445b330 --- /dev/null +++ b/UmlautsExtentions/Program.cs @@ -0,0 +1,20 @@ +using System.Security.Cryptography.X509Certificates; + +namespace UmlautsExtentions +{ + internal class Program + { + static void Main(string[] args) + { + string input = "Ueber ein leben hinaus, aeßert man sich nicht."; + Console.WriteLine(input.Umlauts()); + } + } + static class UmlautsExtentions + { + public static string Umlauts(this string input) + { + return input.Replace("ae","ä").Replace("oe","ö").Replace("ue","ü").Replace("Ae", "Ä").Replace("Oe", "Ö").Replace("Ue", "Ü"); + } + } +} \ No newline at end of file diff --git a/UmlautsExtentions/UmlautsExtentions.csproj b/UmlautsExtentions/UmlautsExtentions.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/UmlautsExtentions/UmlautsExtentions.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/WareHouseSolution/Program.cs b/WareHouseSolution/Program.cs new file mode 100644 index 0000000..3b37dcc --- /dev/null +++ b/WareHouseSolution/Program.cs @@ -0,0 +1,37 @@ +namespace WareHouseSolution +{ + internal class Program + { + static void Main(string[] args) + { + string[] name = { "OTTO", "HERTIE", "KAUFHOF", "COOP", "UDO" }; + Warenhaus[] kette = new Warenhaus[5]; + for (int i = 0; i < kette.Length; i++) + { + kette[i] = new Warenhaus(name[i], 10 * (i + 1), 100 * (i + 1)); + kette[i].PrintInfos(); + } + Warenhaus.PrintInfosGesamt(); + Random rnd = new Random(); + for (int i = 0; i < 100; i++) + { + int warenhaus = rnd.Next(kette.Length); + int aktion = rnd.Next(2); + int anzahl = rnd.Next(1,6); + if (aktion == 0) + { + kette[warenhaus].Einkauf(anzahl); + } + else + { + kette[warenhaus].Verkauf(anzahl); + } + } + foreach (Warenhaus wh in kette) + { + wh.PrintInfos(); + } + Warenhaus.PrintInfosGesamt(); + } + } +} \ No newline at end of file diff --git a/WareHouseSolution/WareHouseSolution.csproj b/WareHouseSolution/WareHouseSolution.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/WareHouseSolution/WareHouseSolution.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/WareHouseSolution/Warenhaus.cs b/WareHouseSolution/Warenhaus.cs new file mode 100644 index 0000000..bdcb700 --- /dev/null +++ b/WareHouseSolution/Warenhaus.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WareHouseSolution +{ + internal class Warenhaus + { + private string? name; + private int warenbestand; + private int kassenbestand; + + private static int anzahl; + private static int warenbestandGesamt; + private static int kassenbestandGesamt; + public Warenhaus(string name, int warenbestand, int kassenbestand) + { + this.name = name; + this.warenbestand = warenbestand; + this.kassenbestand = kassenbestand; + } + + public void PrintInfos() + { + Console.WriteLine($"Name: {name}"); + Console.WriteLine($"Warenbestand: {warenbestand}"); + Console.WriteLine($"Kassenbestand: {kassenbestand}"); + anzahl++; + warenbestandGesamt += warenbestand; + kassenbestandGesamt += kassenbestand; + } + public static void PrintInfosGesamt() + { + Console.WriteLine($"Anzahl: {anzahl}"); + Console.WriteLine($"Warenbestand: {warenbestandGesamt}"); + Console.WriteLine($"Kassenbestand: {kassenbestandGesamt}"); + } + public void Einkauf(int anzahl) + { + if (kassenbestand >= 10 * anzahl) + { + kassenbestand -= 10 * anzahl; + warenbestand += 1; + warenbestand += anzahl; + kassenbestandGesamt -= 10 * anzahl; + warenbestandGesamt += anzahl; + Console.WriteLine($"{name}: Es wurden {anzahl} Waren gekauft"); + } + else { Console.WriteLine($"{name}: Für {anzahl} Waren ist nicht genug Geld vorhanden."); } + } + public void Verkauf(int anzahl) + { + if (anzahl > 0 && warenbestand >= anzahl) + { + kassenbestand += 20 * anzahl; + warenbestand -= anzahl; + kassenbestandGesamt += 20 * anzahl; + warenbestandGesamt -= anzahl; + Console.WriteLine($"{name}: Es wurden {anzahl} Waren verkauft."); + } + else { Console.WriteLine($"{name}: Es sind keine {anzahl} Waren vorhanden."); } + } + } +} diff --git a/Warenkorb/Article.cs b/Warenkorb/Article.cs new file mode 100644 index 0000000..18eff23 --- /dev/null +++ b/Warenkorb/Article.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Warenkorb +{ + abstract class Article + { + private int articleNumber; + private double price; + public Article(int articleNumber, double price) + { + this.articleNumber = articleNumber; + this.price = price; + } + public virtual double GetPrice() + { + return this.price; + } + public virtual int GetarticleNumber() + { + return this.articleNumber; + } + public virtual void PrintInfo() + { + Console.WriteLine($"Artikelnummer: {GetarticleNumber()}"); + Console.WriteLine($"Nettopreis: {this.price:C2}"); + } +} +} diff --git a/Warenkorb/Books.cs b/Warenkorb/Books.cs new file mode 100644 index 0000000..063dcd4 --- /dev/null +++ b/Warenkorb/Books.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Warenkorb +{ + internal class Books : Article + { + private string author; + private string title; + private string yearOfPublishing; + private double vat = 1.07; + + //Books(int articleNumber, double price,) + public Books(int articleNumber, double price, string author, string title, string yearOfPublishing) : base(articleNumber, price) + { + this.author = author; + this.title = title; + this.yearOfPublishing = yearOfPublishing; + } + public override double GetPrice() + { + return base.GetPrice()*vat; + } + public override void PrintInfo() + { + base.PrintInfo(); + Console.WriteLine($"Brutto: {GetPrice():C2}"); + Console.WriteLine($"Autor: {this.author}"); + Console.WriteLine($"Titel: {this.title}"); + Console.WriteLine($"Erscheinungsjahr: {this.yearOfPublishing}"); + } + } +} diff --git a/Warenkorb/DvDs.cs b/Warenkorb/DvDs.cs new file mode 100644 index 0000000..0912aac --- /dev/null +++ b/Warenkorb/DvDs.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Warenkorb +{ + internal class DvDs : Article + { + private string filmTitle; + private int duration; + private string countryCode; + private const double vat = 1.19; + public DvDs(int articleNumber, double price, string filmTitle, int duration, string countryCode) : base(articleNumber, price) + { + this.filmTitle = filmTitle; + this.duration = duration; + this.countryCode = countryCode; + } + public override double GetPrice() + { + return base.GetPrice()*vat; + } + public override void PrintInfo() + { + base.PrintInfo(); + Console.WriteLine($"Brutto: {GetPrice():C2}"); + Console.WriteLine($"Film Titel: {this.filmTitle}"); + Console.WriteLine($"Spieldauer: {this.duration} min"); + Console.WriteLine($"LänderCode: {this.countryCode}"); + } + } +} diff --git a/Warenkorb/Program.cs b/Warenkorb/Program.cs new file mode 100644 index 0000000..c1c0884 --- /dev/null +++ b/Warenkorb/Program.cs @@ -0,0 +1,27 @@ +using System.Text; + +namespace Warenkorb +{ + internal class Program + { + static void Main(string[] args) + { + //Books book1 = new Books(1234, 25.90, "Grimm", "Grimmig", "Grimme Tag"); + //DvDs dvd1 = new DvDs(1235, 30, "Grimm", 120, "de"); + //book1.PrintInfo(); + //Console.WriteLine(); + //dvd1.PrintInfo(); + //Console.WriteLine(); + Console.OutputEncoding = Encoding.UTF8; + Article a1 = new Books(12345, 25.79, "J.K.Rowlling", "Harry Potsau und das Schwein des Weizen", "Pride day 1970"); + Article a2 = new DvDs(12122, 89.00, "Der lange Lurch", 5, "fr"); + Shoppingcart cart1 = new Shoppingcart(); + + cart1.AddArticle(a1); + cart1.AddArticle(a2); + cart1.PrintInfo(); + cart1.PrintTotalPrice(); + + } + } +} \ No newline at end of file diff --git a/Warenkorb/Shoppingcart.cs b/Warenkorb/Shoppingcart.cs new file mode 100644 index 0000000..ee52247 --- /dev/null +++ b/Warenkorb/Shoppingcart.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Runtime.Intrinsics.X86; +using System.Text; +using System.Threading.Tasks; + +namespace Warenkorb +{ + internal class Shoppingcart + { + //private Article[] articles; + //private double salesVolume; + //private double priceVolume; + + //public Shoppingcart(int count) + //{ + // articles = new Article[count]; + //} + //public void AddArticle(Article article) + //{ + // for (int i = 0; i < articles.Length; i++) + // { + // if (articles[i] is null) + // { + // articles[i] = article; + // break; + // } + // } + //} + //public void PrintTotalPrice() + //{ + // foreach (Article item in articleses) + // { + // if (item is not null) + // { + // this.priceVolume += item.GetPrice(); + // } + // } + // Console.WriteLine($"Stückzahl: {salesVolume}"); + // Console.WriteLine($"Gesamtpreis: {this.priceVolume}"); + //} + //public void PrintInfo() + //{ + // foreach (Article item in articleses) + // { + // if (item is not null) + // { + // item.PrintInfo(); + // Console.WriteLine(); + // } + // } + //} + //--------------------------------------------------------------------------------------- + private double totalPrice; + List
articles = new List
(); + public void AddArticle(Article article) + { + articles.Add(article); + } + public void RemoveArticle(Article article) + { + articles.Remove(article); + } + public void PrintTotalPrice() + { + int cnt = 0; + foreach (Article item in articles) + { + this.totalPrice += item.GetPrice(); + cnt++; + } + Console.WriteLine($"Stückzahl: {cnt}"); + Console.WriteLine($"Gesamtpreis: {this.totalPrice:C2}"); + } + + public void PrintInfo() + { + foreach (Article item in articles) + { + item.PrintInfo(); + Console.WriteLine(); + } + } + //---------------------------------------------------------------------------------------- + } +} diff --git a/Warenkorb/Warenkorb.csproj b/Warenkorb/Warenkorb.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Warenkorb/Warenkorb.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/programmday.sln b/programmday.sln new file mode 100644 index 0000000..a194e11 --- /dev/null +++ b/programmday.sln @@ -0,0 +1,217 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33424.131 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MethodenWahnsinn", "programmday\MethodenWahnsinn.csproj", "{25282B14-7BF6-43D4-B9EB-8C2CF01FBBA8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TvSteuerung", "TvSteuerung\TvSteuerung.csproj", "{EAC3A142-D550-4C97-9B52-E9ABBAEDF8B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "warehouse", "warehouse\warehouse.csproj", "{0F7B719A-E1E0-42C5-991C-B7325A1D5421}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WareHouseSolution", "WareHouseSolution\WareHouseSolution.csproj", "{9BF76D39-800B-4D18-BE95-4FDE30D50BBD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StudentenDatenbank", "StudentenDatenbank\StudentenDatenbank.csproj", "{A54E9CFF-C028-4D85-B505-B55197F70E1F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Parkplatz", "Parkplatz\Parkplatz.csproj", "{31DD4498-AEEE-4CBA-83BB-296BFA04AC31}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Parkplatz2", "Parkplatz2\Parkplatz2.csproj", "{A6450674-EBFB-41FF-AA64-830D4459DBAD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simpsons", "Simpsons\Simpsons.csproj", "{68EFE588-23F3-497B-B6A1-858335FA19D8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lohnabrechnung", "Lohnabrechnung\Lohnabrechnung.csproj", "{3C9FCEB4-3628-4233-88D0-0F71B9539347}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "zoo-besucher", "zoo-besucher\zoo-besucher.csproj", "{8B81F83F-0E7F-4DA1-B307-C5006D5ABF0F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-Book", "E-Book\E-Book.csproj", "{5261D976-2436-4D51-B694-E71D437230B6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LohnabrechnungMusterlösung", "LohnabrechnungMusterlösung\LohnabrechnungMusterlösung.csproj", "{B0615B8E-3707-4A29-9F83-7CA1135570D0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KFZ", "KFZ\KFZ.csproj", "{E5566ABC-F3D7-40B2-BD78-032E12597FA2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moped", "Moped\Moped.csproj", "{C379010B-3668-4F55-A032-00D2D18E060A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Warenkorb", "Warenkorb\Warenkorb.csproj", "{D128EBC4-1DA2-4248-A808-00347146310B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AudioPlayer", "AudioPlayer\AudioPlayer.csproj", "{E19E1FCC-BBED-49CB-953A-AB18F0364BE4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AudioPlayerMusterlösung", "AudioPlayerMusterlösung\AudioPlayerMusterlösung.csproj", "{5A4E631C-CCAA-43D5-8CE8-55C8814A2C9E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpielAutomat", "SpielAutomat\SpielAutomat.csproj", "{5F61CDDF-8CB3-4095-9833-E5CEF947AAFC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBANNummerPrüfen", "IBANNummerPrüfen\IBANNummerPrüfen.csproj", "{A4394F01-D418-46CD-9B00-7833AA71A95F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stringaufgabe1", "Stringaufgabe1\Stringaufgabe1.csproj", "{F978E9E6-4F55-48B5-BD12-73316927FA9A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stringaufgabe2", "Stringaufgabe2\Stringaufgabe2.csproj", "{76E98CD6-ABB8-43A0-A991-E4CF406C101F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Palindrom", "Palindrom\Palindrom.csproj", "{DA759AA3-3BD4-4DC9-BC06-9F742452153D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DoppelteBuchstaben", "DoppelteBuchstaben\DoppelteBuchstaben.csproj", "{718AEAE7-FE84-45C2-8364-D1F2831C2B8F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jobs", "Capitalize\Jobs.csproj", "{08BD1654-8E4B-474A-AE3E-2BE954C29D37}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExtensionMethods", "ExtensionMethods\ExtensionMethods.csproj", "{44B6F14F-F509-4EA1-9646-70E533E851BA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SplitWordIntoCountExtensionMethod", "ExtensionMehtod2\SplitWordIntoCountExtensionMethod.csproj", "{6A456A8D-E1D2-4A06-8392-080ECF68E526}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SplitSentencesIntoCountExtentions", "SplitSentencesIntoCountExtentions\SplitSentencesIntoCountExtentions.csproj", "{ADDC7CD8-75C0-4465-8E80-A34117E36852}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SplitCharsIntoCountExtentions", "SplitCharsIntoCountExtentions\SplitCharsIntoCountExtentions.csproj", "{354ACDBF-B798-49A7-9AD0-1094260D3761}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringCountExtention", "StringCountExtention\StringCountExtention.csproj", "{B662FE0E-E01A-4299-8329-9AC884717BAE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvenOrOddExtention", "EvenOrOddExtention\EvenOrOddExtention.csproj", "{4967CE08-BA8C-4FAD-8139-B02F409002A1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PalindromeExtention", "PalindromeExtention\PalindromeExtention.csproj", "{3879A8C8-34FC-4CC7-8AB5-928992C0E445}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DoublingExtention", "DoublingExtention\DoublingExtention.csproj", "{3BC79E5C-41DC-4316-AA98-C908FA27CFA7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmlautsExtentions", "UmlautsExtentions\UmlautsExtentions.csproj", "{0999E988-FB3E-414F-A393-D140771F8387}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {25282B14-7BF6-43D4-B9EB-8C2CF01FBBA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25282B14-7BF6-43D4-B9EB-8C2CF01FBBA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25282B14-7BF6-43D4-B9EB-8C2CF01FBBA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25282B14-7BF6-43D4-B9EB-8C2CF01FBBA8}.Release|Any CPU.Build.0 = Release|Any CPU + {EAC3A142-D550-4C97-9B52-E9ABBAEDF8B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EAC3A142-D550-4C97-9B52-E9ABBAEDF8B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EAC3A142-D550-4C97-9B52-E9ABBAEDF8B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EAC3A142-D550-4C97-9B52-E9ABBAEDF8B8}.Release|Any CPU.Build.0 = Release|Any CPU + {0F7B719A-E1E0-42C5-991C-B7325A1D5421}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F7B719A-E1E0-42C5-991C-B7325A1D5421}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F7B719A-E1E0-42C5-991C-B7325A1D5421}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F7B719A-E1E0-42C5-991C-B7325A1D5421}.Release|Any CPU.Build.0 = Release|Any CPU + {9BF76D39-800B-4D18-BE95-4FDE30D50BBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BF76D39-800B-4D18-BE95-4FDE30D50BBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BF76D39-800B-4D18-BE95-4FDE30D50BBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BF76D39-800B-4D18-BE95-4FDE30D50BBD}.Release|Any CPU.Build.0 = Release|Any CPU + {A54E9CFF-C028-4D85-B505-B55197F70E1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A54E9CFF-C028-4D85-B505-B55197F70E1F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A54E9CFF-C028-4D85-B505-B55197F70E1F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A54E9CFF-C028-4D85-B505-B55197F70E1F}.Release|Any CPU.Build.0 = Release|Any CPU + {31DD4498-AEEE-4CBA-83BB-296BFA04AC31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31DD4498-AEEE-4CBA-83BB-296BFA04AC31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31DD4498-AEEE-4CBA-83BB-296BFA04AC31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31DD4498-AEEE-4CBA-83BB-296BFA04AC31}.Release|Any CPU.Build.0 = Release|Any CPU + {A6450674-EBFB-41FF-AA64-830D4459DBAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6450674-EBFB-41FF-AA64-830D4459DBAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6450674-EBFB-41FF-AA64-830D4459DBAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6450674-EBFB-41FF-AA64-830D4459DBAD}.Release|Any CPU.Build.0 = Release|Any CPU + {68EFE588-23F3-497B-B6A1-858335FA19D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68EFE588-23F3-497B-B6A1-858335FA19D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68EFE588-23F3-497B-B6A1-858335FA19D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68EFE588-23F3-497B-B6A1-858335FA19D8}.Release|Any CPU.Build.0 = Release|Any CPU + {3C9FCEB4-3628-4233-88D0-0F71B9539347}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C9FCEB4-3628-4233-88D0-0F71B9539347}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C9FCEB4-3628-4233-88D0-0F71B9539347}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C9FCEB4-3628-4233-88D0-0F71B9539347}.Release|Any CPU.Build.0 = Release|Any CPU + {8B81F83F-0E7F-4DA1-B307-C5006D5ABF0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B81F83F-0E7F-4DA1-B307-C5006D5ABF0F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B81F83F-0E7F-4DA1-B307-C5006D5ABF0F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B81F83F-0E7F-4DA1-B307-C5006D5ABF0F}.Release|Any CPU.Build.0 = Release|Any CPU + {5261D976-2436-4D51-B694-E71D437230B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5261D976-2436-4D51-B694-E71D437230B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5261D976-2436-4D51-B694-E71D437230B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5261D976-2436-4D51-B694-E71D437230B6}.Release|Any CPU.Build.0 = Release|Any CPU + {B0615B8E-3707-4A29-9F83-7CA1135570D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0615B8E-3707-4A29-9F83-7CA1135570D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0615B8E-3707-4A29-9F83-7CA1135570D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0615B8E-3707-4A29-9F83-7CA1135570D0}.Release|Any CPU.Build.0 = Release|Any CPU + {E5566ABC-F3D7-40B2-BD78-032E12597FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5566ABC-F3D7-40B2-BD78-032E12597FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5566ABC-F3D7-40B2-BD78-032E12597FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5566ABC-F3D7-40B2-BD78-032E12597FA2}.Release|Any CPU.Build.0 = Release|Any CPU + {C379010B-3668-4F55-A032-00D2D18E060A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C379010B-3668-4F55-A032-00D2D18E060A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C379010B-3668-4F55-A032-00D2D18E060A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C379010B-3668-4F55-A032-00D2D18E060A}.Release|Any CPU.Build.0 = Release|Any CPU + {D128EBC4-1DA2-4248-A808-00347146310B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D128EBC4-1DA2-4248-A808-00347146310B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D128EBC4-1DA2-4248-A808-00347146310B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D128EBC4-1DA2-4248-A808-00347146310B}.Release|Any CPU.Build.0 = Release|Any CPU + {E19E1FCC-BBED-49CB-953A-AB18F0364BE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E19E1FCC-BBED-49CB-953A-AB18F0364BE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E19E1FCC-BBED-49CB-953A-AB18F0364BE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E19E1FCC-BBED-49CB-953A-AB18F0364BE4}.Release|Any CPU.Build.0 = Release|Any CPU + {5A4E631C-CCAA-43D5-8CE8-55C8814A2C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A4E631C-CCAA-43D5-8CE8-55C8814A2C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A4E631C-CCAA-43D5-8CE8-55C8814A2C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A4E631C-CCAA-43D5-8CE8-55C8814A2C9E}.Release|Any CPU.Build.0 = Release|Any CPU + {5F61CDDF-8CB3-4095-9833-E5CEF947AAFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F61CDDF-8CB3-4095-9833-E5CEF947AAFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F61CDDF-8CB3-4095-9833-E5CEF947AAFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F61CDDF-8CB3-4095-9833-E5CEF947AAFC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4394F01-D418-46CD-9B00-7833AA71A95F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4394F01-D418-46CD-9B00-7833AA71A95F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4394F01-D418-46CD-9B00-7833AA71A95F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4394F01-D418-46CD-9B00-7833AA71A95F}.Release|Any CPU.Build.0 = Release|Any CPU + {F978E9E6-4F55-48B5-BD12-73316927FA9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F978E9E6-4F55-48B5-BD12-73316927FA9A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F978E9E6-4F55-48B5-BD12-73316927FA9A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F978E9E6-4F55-48B5-BD12-73316927FA9A}.Release|Any CPU.Build.0 = Release|Any CPU + {76E98CD6-ABB8-43A0-A991-E4CF406C101F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {76E98CD6-ABB8-43A0-A991-E4CF406C101F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {76E98CD6-ABB8-43A0-A991-E4CF406C101F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {76E98CD6-ABB8-43A0-A991-E4CF406C101F}.Release|Any CPU.Build.0 = Release|Any CPU + {DA759AA3-3BD4-4DC9-BC06-9F742452153D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA759AA3-3BD4-4DC9-BC06-9F742452153D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA759AA3-3BD4-4DC9-BC06-9F742452153D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA759AA3-3BD4-4DC9-BC06-9F742452153D}.Release|Any CPU.Build.0 = Release|Any CPU + {718AEAE7-FE84-45C2-8364-D1F2831C2B8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {718AEAE7-FE84-45C2-8364-D1F2831C2B8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {718AEAE7-FE84-45C2-8364-D1F2831C2B8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {718AEAE7-FE84-45C2-8364-D1F2831C2B8F}.Release|Any CPU.Build.0 = Release|Any CPU + {08BD1654-8E4B-474A-AE3E-2BE954C29D37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08BD1654-8E4B-474A-AE3E-2BE954C29D37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08BD1654-8E4B-474A-AE3E-2BE954C29D37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08BD1654-8E4B-474A-AE3E-2BE954C29D37}.Release|Any CPU.Build.0 = Release|Any CPU + {44B6F14F-F509-4EA1-9646-70E533E851BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44B6F14F-F509-4EA1-9646-70E533E851BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44B6F14F-F509-4EA1-9646-70E533E851BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44B6F14F-F509-4EA1-9646-70E533E851BA}.Release|Any CPU.Build.0 = Release|Any CPU + {6A456A8D-E1D2-4A06-8392-080ECF68E526}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6A456A8D-E1D2-4A06-8392-080ECF68E526}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6A456A8D-E1D2-4A06-8392-080ECF68E526}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6A456A8D-E1D2-4A06-8392-080ECF68E526}.Release|Any CPU.Build.0 = Release|Any CPU + {ADDC7CD8-75C0-4465-8E80-A34117E36852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADDC7CD8-75C0-4465-8E80-A34117E36852}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADDC7CD8-75C0-4465-8E80-A34117E36852}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADDC7CD8-75C0-4465-8E80-A34117E36852}.Release|Any CPU.Build.0 = Release|Any CPU + {354ACDBF-B798-49A7-9AD0-1094260D3761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {354ACDBF-B798-49A7-9AD0-1094260D3761}.Debug|Any CPU.Build.0 = Debug|Any CPU + {354ACDBF-B798-49A7-9AD0-1094260D3761}.Release|Any CPU.ActiveCfg = Release|Any CPU + {354ACDBF-B798-49A7-9AD0-1094260D3761}.Release|Any CPU.Build.0 = Release|Any CPU + {B662FE0E-E01A-4299-8329-9AC884717BAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B662FE0E-E01A-4299-8329-9AC884717BAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B662FE0E-E01A-4299-8329-9AC884717BAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B662FE0E-E01A-4299-8329-9AC884717BAE}.Release|Any CPU.Build.0 = Release|Any CPU + {4967CE08-BA8C-4FAD-8139-B02F409002A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4967CE08-BA8C-4FAD-8139-B02F409002A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4967CE08-BA8C-4FAD-8139-B02F409002A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4967CE08-BA8C-4FAD-8139-B02F409002A1}.Release|Any CPU.Build.0 = Release|Any CPU + {3879A8C8-34FC-4CC7-8AB5-928992C0E445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3879A8C8-34FC-4CC7-8AB5-928992C0E445}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3879A8C8-34FC-4CC7-8AB5-928992C0E445}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3879A8C8-34FC-4CC7-8AB5-928992C0E445}.Release|Any CPU.Build.0 = Release|Any CPU + {3BC79E5C-41DC-4316-AA98-C908FA27CFA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BC79E5C-41DC-4316-AA98-C908FA27CFA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BC79E5C-41DC-4316-AA98-C908FA27CFA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BC79E5C-41DC-4316-AA98-C908FA27CFA7}.Release|Any CPU.Build.0 = Release|Any CPU + {0999E988-FB3E-414F-A393-D140771F8387}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0999E988-FB3E-414F-A393-D140771F8387}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0999E988-FB3E-414F-A393-D140771F8387}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0999E988-FB3E-414F-A393-D140771F8387}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D4F1BD4A-EAC6-4DED-96A4-58F3F36B04FF} + EndGlobalSection +EndGlobal diff --git a/programmday/MethodenWahnsinn.csproj b/programmday/MethodenWahnsinn.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/programmday/MethodenWahnsinn.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/programmday/Program.cs b/programmday/Program.cs new file mode 100644 index 0000000..4e64742 --- /dev/null +++ b/programmday/Program.cs @@ -0,0 +1,40 @@ +using System.Runtime.CompilerServices; + +namespace MethodenWahnsinn +{ + internal class Program + { + static void Main(string[] args) + { + int x = 42; + int y = Methode1(x); + Console.WriteLine($"{x+y}"); + } + static int Methode1(int x) + { + x += 1; + int y = Methode2(x); + int z = x + y; + return z; + } + static int Methode2(int x) + { + x += 2; + int y = Methode3(x); + int z = x + y; + return z; + } + static int Methode3(int x) + { + x += 3; + int y = Methode4(x); + int z = x + y; + return z; + } + static int Methode4(int x) + { + x += 4; + return x; + } + } +} \ No newline at end of file diff --git a/warehouse/Program.cs b/warehouse/Program.cs new file mode 100644 index 0000000..66eb4de --- /dev/null +++ b/warehouse/Program.cs @@ -0,0 +1,16 @@ +namespace warehouse +{ + internal class Program + { + static void Main(string[] args) + { + + + Warehouse bestand = new Warehouse("test", 20, 80, 100034); + bestand.PrintInfo(); + bestand.Verkauf(); + bestand.Einkauf(); + + } + } +} \ No newline at end of file diff --git a/warehouse/warehouse.csproj b/warehouse/warehouse.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/warehouse/warehouse.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/warehouse/warenhaus.cs b/warehouse/warenhaus.cs new file mode 100644 index 0000000..943810a --- /dev/null +++ b/warehouse/warenhaus.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace warehouse +{ + internal class Warehouse + { + private string name; + + private int warenbestand; + private int kassenbestand; + + public Warehouse(string name, int filialen, int warenbestand, int kassenbestand) + { + this.name = name; + this.warenbestand = warenbestand; + this.kassenbestand = kassenbestand; + } + public void Einkauf() + { + if (this.kassenbestand >= 10) + { + this.kassenbestand -= 10; + this.warenbestand++; + Console.WriteLine($"Kauf ist erfolgt"); + } + else + { + Console.WriteLine("Kauf konnte nicht durchgeführt werden."); + } + } + public void Verkauf() + { + if (this.warenbestand > 0) + { + this.kassenbestand += 20; + this.warenbestand--; + Console.WriteLine("Ware wurde verkauft."); + } + else + { + Console.WriteLine("Keine Ware vorhanden."); + } + } + public void PrintInfo() + { + Console.Write($"Name der Kette: {this.name}, Der Warenbestand beträgt: {this.warenbestand} der Kassenbestand beträgt: {this.kassenbestand}"); + } + } +} diff --git a/zoo-besucher/Adult.cs b/zoo-besucher/Adult.cs new file mode 100644 index 0000000..57467ab --- /dev/null +++ b/zoo-besucher/Adult.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace zoo_besucher +{ + internal class Adult : Visitor + { + public Adult() + { + this.visitorCount = 1; + this.entriy = 15; + } + } +} diff --git a/zoo-besucher/Child.cs b/zoo-besucher/Child.cs new file mode 100644 index 0000000..2175ead --- /dev/null +++ b/zoo-besucher/Child.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace zoo_besucher +{ + internal class Child : Visitor + { + public Child() + { + this.visitorCount = 1; + this.entriy = 0; + } + } +} diff --git a/zoo-besucher/Entrance.cs b/zoo-besucher/Entrance.cs new file mode 100644 index 0000000..9baeccf --- /dev/null +++ b/zoo-besucher/Entrance.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace zoo_besucher +{ + internal class Entrance + { + + private Visitor[] visitor; + private int salesVolume; + private int visitorCount; + public Entrance(int anzahl) + { + visitor = new Visitor[anzahl]; + } + public bool AddVisitor(Visitor visotorCount) + { + for (int i = 0; i < visitor.Length; i++) + { + if (visitor[i] is null) + { + visitor[i] = visotorCount; + salesVolume += visitor[i].GetEntriy(); + visitorCount += visitor[i].GetVisitorCount(); + return true; + } + } + return false; + } + public int GetTurnover() + { + return salesVolume; + } + public int GetVisitor() + { + return visitorCount; + } + public void GetPrintInfo() + { + Console.WriteLine($"Die Besucherzahlt beträgt: {GetVisitor()}"); + Console.WriteLine($"Die Einnahmen belaufen sich auf: {GetTurnover()}"); + } + } +} diff --git a/zoo-besucher/Group.cs b/zoo-besucher/Group.cs new file mode 100644 index 0000000..f0219de --- /dev/null +++ b/zoo-besucher/Group.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace zoo_besucher +{ + internal class Group : Visitor + { + public Group(int visitorCount) + { + this.entriy = 50; + this.visitorCount = visitorCount; + } + } +} diff --git a/zoo-besucher/Program.cs b/zoo-besucher/Program.cs new file mode 100644 index 0000000..100aca5 --- /dev/null +++ b/zoo-besucher/Program.cs @@ -0,0 +1,19 @@ +namespace zoo_besucher +{ + internal class Program + { + static void Main(string[] args) + { + Group gruppe = new Group(20); + Adult erwachsene = new Adult(); + Child kinder = new Child(); + Entrance eingang = new Entrance(3); + + eingang.AddVisitor(erwachsene); + eingang.AddVisitor(kinder); + eingang.AddVisitor(gruppe); + eingang.AddVisitor(gruppe); + eingang.GetPrintInfo(); + } + } +} \ No newline at end of file diff --git a/zoo-besucher/Visitor.cs b/zoo-besucher/Visitor.cs new file mode 100644 index 0000000..97342c1 --- /dev/null +++ b/zoo-besucher/Visitor.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace zoo_besucher +{ + internal class Visitor + { + protected int visitorCount; + protected int entriy; + + public int GetVisitorCount() + { return visitorCount; } + public int GetEntriy() + { return entriy; } + } +} diff --git a/zoo-besucher/zoo-besucher.csproj b/zoo-besucher/zoo-besucher.csproj new file mode 100644 index 0000000..d93cf96 --- /dev/null +++ b/zoo-besucher/zoo-besucher.csproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + zoo_besucher + enable + enable + + +