From 0ae15894a1d21aa764a56afb6ddf14318a454cdc Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Fri, 12 Jan 2018 23:21:23 +0100 Subject: [PATCH] add events and interface excercises --- oop/asp_textfile/asp_textfile/Default.aspx.cs | 22 ++++++- oop/asp_textfile/asp_textfile/WriteToFile.cs | 8 ++- oop/events/events.sln | 22 +++++++ oop/events/events/App.config | 6 ++ oop/events/events/EventArgument.cs | 17 ++++++ oop/events/events/Program.cs | 27 +++++++++ oop/events/events/Properties/AssemblyInfo.cs | 36 ++++++++++++ oop/events/events/Publisher.cs | 26 +++++++++ oop/events/events/Subscriber.cs | 20 +++++++ oop/events/events/events.csproj | 55 ++++++++++++++++++ oop/interfaces/interfaces.sln | 22 +++++++ oop/interfaces/interfaces/App.config | 6 ++ oop/interfaces/interfaces/ILebewesen.cs | 15 +++++ oop/interfaces/interfaces/Mensch.cs | 26 +++++++++ oop/interfaces/interfaces/Program.cs | 32 ++++++++++ .../interfaces/Properties/AssemblyInfo.cs | 36 ++++++++++++ oop/interfaces/interfaces/Tier.cs | 25 ++++++++ oop/interfaces/interfaces/interfaces.csproj | 55 ++++++++++++++++++ oop/notenbewertung/notenbewertung.sln | 22 +++++++ oop/notenbewertung/notenbewertung/App.config | 6 ++ oop/notenbewertung/notenbewertung/Dozent.cs | 17 ++++++ oop/notenbewertung/notenbewertung/Klasse.cs | 19 ++++++ oop/notenbewertung/notenbewertung/Person.cs | 15 +++++ oop/notenbewertung/notenbewertung/Program.cs | 27 +++++++++ .../notenbewertung/Properties/AssemblyInfo.cs | 36 ++++++++++++ oop/notenbewertung/notenbewertung/Schule.cs | 18 ++++++ oop/notenbewertung/notenbewertung/Student.cs | 35 +++++++++++ .../notenbewertung/notenbewertung.csproj | 58 +++++++++++++++++++ 28 files changed, 704 insertions(+), 5 deletions(-) create mode 100644 oop/events/events.sln create mode 100644 oop/events/events/App.config create mode 100644 oop/events/events/EventArgument.cs create mode 100644 oop/events/events/Program.cs create mode 100644 oop/events/events/Properties/AssemblyInfo.cs create mode 100644 oop/events/events/Publisher.cs create mode 100644 oop/events/events/Subscriber.cs create mode 100644 oop/events/events/events.csproj create mode 100644 oop/interfaces/interfaces.sln create mode 100644 oop/interfaces/interfaces/App.config create mode 100644 oop/interfaces/interfaces/ILebewesen.cs create mode 100644 oop/interfaces/interfaces/Mensch.cs create mode 100644 oop/interfaces/interfaces/Program.cs create mode 100644 oop/interfaces/interfaces/Properties/AssemblyInfo.cs create mode 100644 oop/interfaces/interfaces/Tier.cs create mode 100644 oop/interfaces/interfaces/interfaces.csproj create mode 100644 oop/notenbewertung/notenbewertung.sln create mode 100644 oop/notenbewertung/notenbewertung/App.config create mode 100644 oop/notenbewertung/notenbewertung/Dozent.cs create mode 100644 oop/notenbewertung/notenbewertung/Klasse.cs create mode 100644 oop/notenbewertung/notenbewertung/Person.cs create mode 100644 oop/notenbewertung/notenbewertung/Program.cs create mode 100644 oop/notenbewertung/notenbewertung/Properties/AssemblyInfo.cs create mode 100644 oop/notenbewertung/notenbewertung/Schule.cs create mode 100644 oop/notenbewertung/notenbewertung/Student.cs create mode 100644 oop/notenbewertung/notenbewertung/notenbewertung.csproj diff --git a/oop/asp_textfile/asp_textfile/Default.aspx.cs b/oop/asp_textfile/asp_textfile/Default.aspx.cs index c932d43..009d23c 100644 --- a/oop/asp_textfile/asp_textfile/Default.aspx.cs +++ b/oop/asp_textfile/asp_textfile/Default.aspx.cs @@ -9,6 +9,9 @@ namespace asp_textfile { public partial class WebForm1 : System.Web.UI.Page { + + public delegate void DelText(_input); + protected void Page_Load(object sender, EventArgs e) { @@ -18,8 +21,21 @@ namespace asp_textfile { - // https://stackoverflow.com/questions/1268766/writing-file-to-web-server-asp-net#1268773 - WriteToFile.SaveToFile(UserInputBox.Text, Server.MapPath("~/string_data.txt")); + DelText dt; + dt = WriteToFile.Write; + if (UserInputBox_Checked) { + dt += ReturnTextFile.Read + } + + filePath = Server.MapPath("~/string_data.txt") + dt(UserInputBox.Text, filePath) + + public static class ReturnTextFile { + + public static void Read(_path){ + + } + } } protected void UserInputBox_TextChanged(object sender, EventArgs e) @@ -32,4 +48,4 @@ namespace asp_textfile } } -} \ No newline at end of file +} diff --git a/oop/asp_textfile/asp_textfile/WriteToFile.cs b/oop/asp_textfile/asp_textfile/WriteToFile.cs index 5238557..a3b8c2b 100644 --- a/oop/asp_textfile/asp_textfile/WriteToFile.cs +++ b/oop/asp_textfile/asp_textfile/WriteToFile.cs @@ -10,9 +10,13 @@ namespace asp_textfile { public static class WriteToFile { - public static void SaveToFile(string _input, string path) + public static void Write(string _input, string path) { + using (StreamWriter _rawData = new StreamWriter(path, true)) + { + _rawData.WriteLine(_input); // Write the file. + } File.WriteAllText(path, _input); } } -} \ No newline at end of file +} diff --git a/oop/events/events.sln b/oop/events/events.sln new file mode 100644 index 0000000..bce2ddb --- /dev/null +++ b/oop/events/events.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "events", "events\events.csproj", "{594FE2E5-9A74-4B72-A1C0-0D4DAC9E811B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {594FE2E5-9A74-4B72-A1C0-0D4DAC9E811B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {594FE2E5-9A74-4B72-A1C0-0D4DAC9E811B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {594FE2E5-9A74-4B72-A1C0-0D4DAC9E811B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {594FE2E5-9A74-4B72-A1C0-0D4DAC9E811B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/oop/events/events/App.config b/oop/events/events/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/oop/events/events/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/oop/events/events/EventArgument.cs b/oop/events/events/EventArgument.cs new file mode 100644 index 0000000..d1318d4 --- /dev/null +++ b/oop/events/events/EventArgument.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace events +{ + public class EventArgument : EventArgs + { + public string message; + public EventArgument(string s) + { + this.message = s; + } + } +} diff --git a/oop/events/events/Program.cs b/oop/events/events/Program.cs new file mode 100644 index 0000000..98d6c8f --- /dev/null +++ b/oop/events/events/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace events +{ + class Program + { + static void Main(string[] args) + { + Publisher pub = new Publisher(); + Subscriber sub1 = new Subscriber(); + Subscriber sub2 = new Subscriber(); + + + pub.Register(sub1.WriteMessage1); + pub.Register(sub2.WriteMessage1); + pub.Register(sub1.WriteMessage2); + + pub.Publish("Test"); + Console.ReadKey(); + + } + } +} diff --git a/oop/events/events/Properties/AssemblyInfo.cs b/oop/events/events/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..42dfc91 --- /dev/null +++ b/oop/events/events/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("events")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("events")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("594fe2e5-9a74-4b72-a1c0-0d4dac9e811b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/oop/events/events/Publisher.cs b/oop/events/events/Publisher.cs new file mode 100644 index 0000000..8a3f837 --- /dev/null +++ b/oop/events/events/Publisher.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace events +{ + class Publisher + { + public delegate void EventDelegate(EventArgument s); + public event EventDelegate eventHandler; + + public void Register(EventDelegate s) + { + eventHandler += s; + } + + public void Publish (string m) + { + EventArgument ea = new EventArgument(m); + eventHandler(ea); + } + + } +} diff --git a/oop/events/events/Subscriber.cs b/oop/events/events/Subscriber.cs new file mode 100644 index 0000000..c2a89f5 --- /dev/null +++ b/oop/events/events/Subscriber.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace events +{ + public class Subscriber + { + public void WriteMessage1(EventArgument s) + { + Console.WriteLine(s.message + "Message 1"); + } + public void WriteMessage2(EventArgument s) + { + Console.WriteLine(s.message + "Message 2"); + } + } +} diff --git a/oop/events/events/events.csproj b/oop/events/events/events.csproj new file mode 100644 index 0000000..0464fb9 --- /dev/null +++ b/oop/events/events/events.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {594FE2E5-9A74-4B72-A1C0-0D4DAC9E811B} + Exe + events + events + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/oop/interfaces/interfaces.sln b/oop/interfaces/interfaces.sln new file mode 100644 index 0000000..4667e5c --- /dev/null +++ b/oop/interfaces/interfaces.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "interfaces", "interfaces\interfaces.csproj", "{2DEDA958-4040-47EC-AC37-BE0666D8C89B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2DEDA958-4040-47EC-AC37-BE0666D8C89B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2DEDA958-4040-47EC-AC37-BE0666D8C89B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2DEDA958-4040-47EC-AC37-BE0666D8C89B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2DEDA958-4040-47EC-AC37-BE0666D8C89B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/oop/interfaces/interfaces/App.config b/oop/interfaces/interfaces/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/oop/interfaces/interfaces/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/oop/interfaces/interfaces/ILebewesen.cs b/oop/interfaces/interfaces/ILebewesen.cs new file mode 100644 index 0000000..f7c4498 --- /dev/null +++ b/oop/interfaces/interfaces/ILebewesen.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace interfaces +{ + interface ILebewesen + { + int AnzahlBeine { get; set; } + string Ton { get; set; } + void GibLaut(); + } +} diff --git a/oop/interfaces/interfaces/Mensch.cs b/oop/interfaces/interfaces/Mensch.cs new file mode 100644 index 0000000..629e290 --- /dev/null +++ b/oop/interfaces/interfaces/Mensch.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace interfaces +{ + class Mensch : ILebewesen + { + public int AnzahlBeine { get; set; } + public string Ton { get; set; } + + public Mensch(int i, string s) + { + this.AnzahlBeine = i; + this.Ton = s; + + } + + public void GibLaut() + { + Console.WriteLine(this.Ton); + } + } +} diff --git a/oop/interfaces/interfaces/Program.cs b/oop/interfaces/interfaces/Program.cs new file mode 100644 index 0000000..04122a5 --- /dev/null +++ b/oop/interfaces/interfaces/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace interfaces +{ + class Program + { + static void Main(string[] args) + { + Mensch mensch = new Mensch(2, "Hallo"); + Tier hund = new Tier(4, "Wuff"); + Tier katze = new Tier(4, "Miau"); + + List viecher = new List(); + + viecher.Add(mensch); + viecher.Add(hund); + viecher.Add(katze); + + foreach (var i in viecher) + { + i.GibLaut(); + } + + Console.ReadKey(); + + } + } +} diff --git a/oop/interfaces/interfaces/Properties/AssemblyInfo.cs b/oop/interfaces/interfaces/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3fd46fd --- /dev/null +++ b/oop/interfaces/interfaces/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("interfaces")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("interfaces")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2deda958-4040-47ec-ac37-be0666d8c89b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/oop/interfaces/interfaces/Tier.cs b/oop/interfaces/interfaces/Tier.cs new file mode 100644 index 0000000..2e14319 --- /dev/null +++ b/oop/interfaces/interfaces/Tier.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace interfaces +{ + class Tier : ILebewesen + { + public int AnzahlBeine { get; set; } + public string Ton { get; set; } + public Tier(int i, string s) + { + this.AnzahlBeine = i; + this.Ton = s; + + } + + public void GibLaut() + { + Console.WriteLine(this.Ton); + } + } +} diff --git a/oop/interfaces/interfaces/interfaces.csproj b/oop/interfaces/interfaces/interfaces.csproj new file mode 100644 index 0000000..17fedd3 --- /dev/null +++ b/oop/interfaces/interfaces/interfaces.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {2DEDA958-4040-47EC-AC37-BE0666D8C89B} + Exe + interfaces + interfaces + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/oop/notenbewertung/notenbewertung.sln b/oop/notenbewertung/notenbewertung.sln new file mode 100644 index 0000000..400326c --- /dev/null +++ b/oop/notenbewertung/notenbewertung.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "notenbewertung", "notenbewertung\notenbewertung.csproj", "{F0480126-E387-401A-AC5B-665A93087F38}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F0480126-E387-401A-AC5B-665A93087F38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0480126-E387-401A-AC5B-665A93087F38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0480126-E387-401A-AC5B-665A93087F38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0480126-E387-401A-AC5B-665A93087F38}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/oop/notenbewertung/notenbewertung/App.config b/oop/notenbewertung/notenbewertung/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/oop/notenbewertung/notenbewertung/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/oop/notenbewertung/notenbewertung/Dozent.cs b/oop/notenbewertung/notenbewertung/Dozent.cs new file mode 100644 index 0000000..2dcff5f --- /dev/null +++ b/oop/notenbewertung/notenbewertung/Dozent.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace notenbewertung +{ + class Dozent : Person + { + public Dozent(string _vorname, string _name) + { + this.Vorname = _vorname; + this.Name = _name; + } + } +} diff --git a/oop/notenbewertung/notenbewertung/Klasse.cs b/oop/notenbewertung/notenbewertung/Klasse.cs new file mode 100644 index 0000000..ed1a51d --- /dev/null +++ b/oop/notenbewertung/notenbewertung/Klasse.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace notenbewertung +{ + class Klasse + { + List personen = new List(); + public string Klassenbezeichnung { get; set; } + + public Klasse(string _Klassenbezeichnung) + { + this.Klassenbezeichnung = _Klassenbezeichnung; + } + } +} diff --git a/oop/notenbewertung/notenbewertung/Person.cs b/oop/notenbewertung/notenbewertung/Person.cs new file mode 100644 index 0000000..22f6957 --- /dev/null +++ b/oop/notenbewertung/notenbewertung/Person.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace notenbewertung +{ + abstract class Person + { + public string Vorname { get; set; } + public string Name { get; set; } + + } +} diff --git a/oop/notenbewertung/notenbewertung/Program.cs b/oop/notenbewertung/notenbewertung/Program.cs new file mode 100644 index 0000000..80fbf2f --- /dev/null +++ b/oop/notenbewertung/notenbewertung/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace notenbewertung +{ + class Program + { + static void Main(string[] args) + { + Schule ibz = new Schule("Aarau"); + Klasse ti5 = new Klasse("TI5"); + Student andreas = new Student("Andreas", "Zweili"); + Dozent thomas = new Dozent("Thomas", "Steiner"); + Testresultat exam1 = new Testresultat(5.1); + Testresultat exam2 = new Testresultat(5.2); + Testresultat exam3 = new Testresultat(5.3); + andreas.noten.Add(exam1); + andreas.noten.Add(exam2); + andreas.noten.Add(exam3); + Console.WriteLine(andreas.GetNotenDurchSchnitt().ToString()); + Console.ReadKey(); + } + } +} diff --git a/oop/notenbewertung/notenbewertung/Properties/AssemblyInfo.cs b/oop/notenbewertung/notenbewertung/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..80fcf2f --- /dev/null +++ b/oop/notenbewertung/notenbewertung/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("notenbewertung")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("notenbewertung")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f0480126-e387-401a-ac5b-665a93087f38")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/oop/notenbewertung/notenbewertung/Schule.cs b/oop/notenbewertung/notenbewertung/Schule.cs new file mode 100644 index 0000000..f614a06 --- /dev/null +++ b/oop/notenbewertung/notenbewertung/Schule.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace notenbewertung +{ + class Schule + { + string Standort { get; set; } + List klassen = new List(); + public Schule(string _standort) + { + this.Standort = _standort; + } + } +} diff --git a/oop/notenbewertung/notenbewertung/Student.cs b/oop/notenbewertung/notenbewertung/Student.cs new file mode 100644 index 0000000..6e9f6dd --- /dev/null +++ b/oop/notenbewertung/notenbewertung/Student.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace notenbewertung +{ + class Student : Person + { + public List noten = new List(); + double summe; + public Student(string _vorname, string _name) + { + this.Vorname = _vorname; + this.Name = _name; + } + + public double GetNotenDurchSchnitt() + { + if (noten.Count > 0) + { + int counter = 0; + this.summe = 0; + foreach (var i in noten) + { + this.summe += i.Note; + counter++; + } + return this.summe / counter; + } + return this.summe; + } + } +} diff --git a/oop/notenbewertung/notenbewertung/notenbewertung.csproj b/oop/notenbewertung/notenbewertung/notenbewertung.csproj new file mode 100644 index 0000000..4ad9372 --- /dev/null +++ b/oop/notenbewertung/notenbewertung/notenbewertung.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {F0480126-E387-401A-AC5B-665A93087F38} + Exe + notenbewertung + notenbewertung + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file