diff --git a/DesPat.sln b/DesPat.sln new file mode 100644 index 0000000..d8e1405 --- /dev/null +++ b/DesPat.sln @@ -0,0 +1,58 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HueLights", "HueLights\HueLights.csproj", "{9D404DA7-E094-4031-B3B9-3041C2E69CE4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pannenkoekenhuis", "Pannenkoekenhuis\Pannenkoekenhuis.csproj", "{A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|ARM.ActiveCfg = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|ARM.Build.0 = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|x64.ActiveCfg = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|x64.Build.0 = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|x86.ActiveCfg = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Debug|x86.Build.0 = Debug|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|Any CPU.Build.0 = Release|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|ARM.ActiveCfg = Release|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|ARM.Build.0 = Release|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|x64.ActiveCfg = Release|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|x64.Build.0 = Release|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|x86.ActiveCfg = Release|Any CPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4}.Release|x86.Build.0 = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|ARM.ActiveCfg = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|ARM.Build.0 = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|x64.ActiveCfg = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|x64.Build.0 = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|x86.ActiveCfg = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|x86.Build.0 = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|Any CPU.Build.0 = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|ARM.ActiveCfg = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|ARM.Build.0 = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|x64.ActiveCfg = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|x64.Build.0 = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|x86.ActiveCfg = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/HueLights/App.config b/HueLights/App.config new file mode 100644 index 0000000..d740e88 --- /dev/null +++ b/HueLights/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/HueLights/HueLights.csproj b/HueLights/HueLights.csproj new file mode 100644 index 0000000..108f074 --- /dev/null +++ b/HueLights/HueLights.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {9D404DA7-E094-4031-B3B9-3041C2E69CE4} + Exe + Properties + HueLights + HueLights + 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/HueLights/Light.cs b/HueLights/Light.cs new file mode 100644 index 0000000..848bebf --- /dev/null +++ b/HueLights/Light.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HueLights +{ + public abstract class Light + { + protected int id { get; } + protected bool on { get; set; } + protected int bri { get; set; } + protected int hue { get; set; } + protected int sat { get; set; } + + public Light(int id) + { + this.id = id; + this.on = false; + this.bri = 255; + this.hue = 0; + this.sat = 0; + } + + public virtual int getID() + { + return id; + } + + public virtual bool getState() + { + return on; + } + public virtual void setState(bool on) + { + this.on = on; + } + + public virtual int getBrightness() + { + return bri; + } + public virtual void setBrightness(int bri) + { + this.bri = bri; + } + + public virtual int getHue() + { + return hue; + } + public virtual void setHue(int hue) + { + this.hue = hue; + } + + public virtual int getSaturation() + { + return sat; + } + public virtual void setSaturation(int sat) + { + this.sat = sat; + } + + public abstract void Update(); + + public override string ToString() + { + return "Light " + id + " is " + (getState() ? "on" : "off"); + } + } +} diff --git a/HueLights/LightHandler.cs b/HueLights/LightHandler.cs new file mode 100644 index 0000000..c9b7d17 --- /dev/null +++ b/HueLights/LightHandler.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HueLights +{ + class LightHandler + { + static void Main(string[] args) + { + new LightHandler(); + } + + private List lights; + + public LightHandler() + { + lights = new List(); + + Populate(); + RunTest(); + } + + private void RunTest() + { + Random r = new Random(); + + TurnOn(lights[r.Next(0, lights.Count)].getID()); + + Update(); + + Console.ReadLine(); + } + + private void Populate() + { + lights.Add(new LightHue(1, 100)); + lights.Add(new LightHue(2, 200)); + lights.Add(new LigthLux(3, 300)); + } + + public void TurnOn(int id) + { + lights.ForEach(a => { if (a.getID() == id) { a.setState(true); } }); + } + + public void Update() + { + lights.ForEach(a => a.Update() ); + } + } +} diff --git a/HueLights/LightHue.cs b/HueLights/LightHue.cs new file mode 100644 index 0000000..3fcc622 --- /dev/null +++ b/HueLights/LightHue.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HueLights +{ + public class LightHue : Light + { + public LightHue(int id, int hue) : base(id) + { + this.hue = hue; + this.sat = 255; + } + + public override void Update() + { + Console.WriteLine(this.ToString()); + } + + public override string ToString() + { + return base.ToString() + ". bri=" + bri + ", hue=" + hue + ", sat=" + sat; + } + } +} diff --git a/HueLights/LigthLux.cs b/HueLights/LigthLux.cs new file mode 100644 index 0000000..96b37f3 --- /dev/null +++ b/HueLights/LigthLux.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HueLights +{ + public class LigthLux : Light + { + public LigthLux(int id, int bri) : base(id) + { + this.bri = bri; + } + + public override void Update() + { + Console.WriteLine(this.ToString()); + } + + public override string ToString() + { + return base.ToString() + ". bri=" + bri; + } + } +} diff --git a/HueLights/Properties/AssemblyInfo.cs b/HueLights/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7f4c3eb --- /dev/null +++ b/HueLights/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("HueLights")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("HueLights")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[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("9d404da7-e094-4031-b3b9-3041c2e69ce4")] + +// 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/Pannenkoekenhuis/App.config b/Pannenkoekenhuis/App.config new file mode 100644 index 0000000..d740e88 --- /dev/null +++ b/Pannenkoekenhuis/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Pannenkoekenhuis/Builder/Pannenkoek.cs b/Pannenkoekenhuis/Builder/Pannenkoek.cs new file mode 100644 index 0000000..645d7a1 --- /dev/null +++ b/Pannenkoekenhuis/Builder/Pannenkoek.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Builder +{ + class Pannenkoek + { + private string beschrijving; + private int formaat; + private double prijs; + private bool stroop; + private bool suiker; + private bool spek; + private bool kaas; + + public Pannenkoek(string beschrijving, int formaat, double prijs, bool metStroop, bool metSuiker, bool metSpek, bool metKaas) + { + this.beschrijving = beschrijving; + this.formaat = formaat; + this.prijs = prijs; + this.stroop = metStroop; + this.suiker = metSuiker; + this.spek = metSpek; + this.kaas = metKaas; + } + + public Pannenkoek(PannenkoekBuilder builder) + { + this.beschrijving = PannenkoekBuilder.beschrijving; + this.formaat = PannenkoekBuilder.formaat; + this.prijs = PannenkoekBuilder.prijs; + this.stroop = PannenkoekBuilder.stroop; + this.suiker = PannenkoekBuilder.suiker; + this.spek = PannenkoekBuilder.spek; + this.kaas = PannenkoekBuilder.kaas; + } + } +} diff --git a/Pannenkoekenhuis/Builder/PannenkoekBuilder.cs b/Pannenkoekenhuis/Builder/PannenkoekBuilder.cs new file mode 100644 index 0000000..e886589 --- /dev/null +++ b/Pannenkoekenhuis/Builder/PannenkoekBuilder.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Builder +{ + class PannenkoekBuilder + { + public static string beschrijving; + public static double prijs; + public static int formaat; + public static bool stroop; + public static bool suiker; + public static bool spek; + public static bool kaas; + + public PannenkoekBuilder MaakPannenkoek(string beschr, double pr) + { + beschrijving = beschr; + prijs = pr; + formaat = 0; + stroop = false; + suiker = false; + spek = false; + kaas = false; + return this; + } + public PannenkoekBuilder Formaat(int f) + { + formaat = f; + return this; + } + public PannenkoekBuilder MetStroop() + { + stroop = true; + return this; + } + public PannenkoekBuilder MetSuiker() + { + suiker = true; + return this; + } + public PannenkoekBuilder MetSpek() + { + spek = true; + return this; + } + public PannenkoekBuilder MetKaas() + { + kaas = true; + return this; + } + public Pannenkoek Build() + { + return new Pannenkoek(this); + } + } +} diff --git a/Pannenkoekenhuis/Builder/desktop.ini b/Pannenkoekenhuis/Builder/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Builder/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/ClassDiagram1.cd b/Pannenkoekenhuis/ClassDiagram1.cd new file mode 100644 index 0000000..bf0be08 --- /dev/null +++ b/Pannenkoekenhuis/ClassDiagram1.cd @@ -0,0 +1,123 @@ + + + + + + AAAAAAAAAAAAAAAAAACABAABABQAAAAAAAAAAIAAAAA= + Composite\Menu.cs + + + + + + AAAAAAAAAAAAAIAAAAAAAAABABAAAAAAAAAAAIAAQAA= + Composite\MenuComponent.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAABAAACAAAAAAAAAAAAAAA= + Composite\MenuItem.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Champignon.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Honing.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Stroop.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Suiker.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Ui.cs + + + + + + AAAAAAAIAAAAAAAAAAAAAAAgAAAAAAAgAQAAAAAAAQA= + Decorators\PannenkoekDecorator.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA= + TestMenu.cs + + + + + + AAAAAAAAAAAAAAAAAAAQABAAGAEAQAAAAAAAAIAAAAA= + Kassabon.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Pannenkoek.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA= + Program.cs + + + + + + AAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAA= + TestKassabon.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAgAAAAAAAAAAA= + Strategy\KortingsCalculator.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAA= + Strategy\NaturelKorting.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAA= + Strategy\NulKorting.cs + + + + \ No newline at end of file diff --git a/Pannenkoekenhuis/ClassDiagram2.cd b/Pannenkoekenhuis/ClassDiagram2.cd new file mode 100644 index 0000000..52686b3 --- /dev/null +++ b/Pannenkoekenhuis/ClassDiagram2.cd @@ -0,0 +1,158 @@ + + + + + + AAAAAAAAAAAAAAAAAACABAABABQAAAAAAAAAAIAAAAA= + Composite\Menu.cs + + + + + + AAAAAAAAAAAAAIAAAAAAAAABABAAAAAAAAAAAIAAQAA= + Composite\MenuComponent.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAABAAACAAAAAAAAAAAAAAA= + Composite\MenuItem.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Champignon.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Honing.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Kaas.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Stroop.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Suiker.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Ui.cs + + + + + + AAQAAAIIAAAAgAAAAAAAAAAgABAIAAAgAQAAAAAAAQA= + Decorators\PannenkoekDecorator.cs + + + + + + AAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + TestFactory.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA= + TestMenu.cs + + + + + + AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Factory\KaasPannenkoekFactory.cs + + + + + + AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAA= + Factory\PannenkoekenFactory.cs + + + + + + AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Factory\StroopPannenkoekFactory.cs + + + + + + AAAAAAAAAAAAAAAAAAAQABAAGAEAQAAAAAAAAIAAAAA= + Kassabon.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Pannenkoek.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA= + Program.cs + + + + + + AAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAA= + TestKassabon.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAgAAAAAAAAAAA= + Strategy\KortingsCalculator.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAA= + Strategy\NaturelKorting.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAA= + Strategy\NulKorting.cs + + + + \ No newline at end of file diff --git a/Pannenkoekenhuis/ClassDiagram3.cd b/Pannenkoekenhuis/ClassDiagram3.cd new file mode 100644 index 0000000..dadf18d --- /dev/null +++ b/Pannenkoekenhuis/ClassDiagram3.cd @@ -0,0 +1,223 @@ + + + + + + AAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Command\Keuken.cs + + + + + + AAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAI= + Command\Klant.cs + + + + + + AAAAAACAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAEA= + Command\Serveerster.cs + + + + + + AAAAAAAAAAAAAAAAAACABAABABQAAAAAAAAAAIAAAAA= + Composite\Menu.cs + + + + + + AAAAAAAAAAAAAIAAAAAAAAABABAAAAAAAAAAAIAAQAA= + Composite\MenuComponent.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAABAAACAAAAAAAAAAAAAAA= + Composite\MenuItem.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Champignon.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Honing.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Kaas.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Stroop.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Suiker.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Decorators\Ui.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAACAAAgAAAAAAEAAAA= + Decorators\PannenkoekDecorator.cs + + + + + + AAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + TestFactory.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA= + TestMenu.cs + + + + + + AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Factory\KaasPannenkoekFactory.cs + + + + + + AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAA= + Factory\PannenkoekenFactory.cs + + + + + + AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Factory\StroopPannenkoekFactory.cs + + + + + + AAAAAAAAAAAAAAAAAAAQABAAGAEAQAAAAAAAAIAAAAA= + Kassabon.cs + + + + + + AAQAAAIAAAAAgAAAAAAAAAAAABAIIAAAAAAAAAEAAAA= + Pannenkoek.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA= + Program.cs + + + + + + AAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAA= + TestKassabon.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAABAAAAQAAAAAAACAAAAAA= + Observer\OnlineMenu.cs + + + + + + + AAQAACAAAAAAAAAQAAAAAAAEABAAQAAAAAAAAIAAAAA= + Observer\Recepten.cs + + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAA= + State\Klant.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAgAAAAAAAAAAA= + Strategy\KortingsCalculator.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAA= + Strategy\NaturelKorting.cs + + + + + + AAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAA= + Strategy\NulKorting.cs + + + + + + AAQAACAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAA= + Observer\MenuGegevens.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAA= + Observer\ObserverMenu.cs + + + + + + ABAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAQAAAgAAAAAg= + State\State.cs + + + + \ No newline at end of file diff --git a/Pannenkoekenhuis/Command/Keuken.cs b/Pannenkoekenhuis/Command/Keuken.cs new file mode 100644 index 0000000..75f29eb --- /dev/null +++ b/Pannenkoekenhuis/Command/Keuken.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Command +{ + class Keuken + { + public Keuken() + { + + } + + public void bakPannenkoek() + { + //Hier zou je gebruik kunnen maken van een Pannenkoekfactory om de pannenkoek te maken. + } + } + + +} diff --git a/Pannenkoekenhuis/Command/Klant.cs b/Pannenkoekenhuis/Command/Klant.cs new file mode 100644 index 0000000..f40e26d --- /dev/null +++ b/Pannenkoekenhuis/Command/Klant.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Command +{ + class Klant + { + String naam; + Serveerster server; + + public Klant() + { + server = new Serveerster(this); + } + + + //Geef aan deze methode mee wat voor pannenkoek men zou willen. Dit word dan meegegeven aan bestelPannenkoek() + public void geefBestelling() + { + server.BestelPannenkoek(); + } + + } +} diff --git a/Pannenkoekenhuis/Command/Serveerster.cs b/Pannenkoekenhuis/Command/Serveerster.cs new file mode 100644 index 0000000..9e58ba2 --- /dev/null +++ b/Pannenkoekenhuis/Command/Serveerster.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Command +{ + class Serveerster + { + private Klant klant; + private Keuken keuken; + + public Serveerster(Klant klant) + { + this.klant = klant;//Serveerster kan uiteraard ook meerdere klanten afhandelen maar hier gaan we uit van een klant. + keuken = new Keuken(); + } + //Geef hier ook mee wat voor pannenkoek er gemaakt zou moeten worden. + public void BestelPannenkoek() + { + keuken.bakPannenkoek(); + } + } +} diff --git a/Pannenkoekenhuis/Command/desktop.ini b/Pannenkoekenhuis/Command/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Command/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/Composite/Menu.cs b/Pannenkoekenhuis/Composite/Menu.cs new file mode 100644 index 0000000..e156af7 --- /dev/null +++ b/Pannenkoekenhuis/Composite/Menu.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Composite +{ + public class Menu : MenuComponent + { + string naam; + List components; + + public Menu(string naam) + { + this.naam = naam; + components = new List(); + } + + public override string DrukAf() + { + string str = naam + "\n"; + foreach(MenuComponent m in components) + { + str += "\t" + m.DrukAf() + "\n"; + } + return str; + } + + public override void VoegToe(MenuComponent m) + { + components.Add(m); + } + + public override void Verwijder(MenuComponent m) + { + components.Remove(m); + } + + public string Naam() + { + return naam; + } + } +} diff --git a/Pannenkoekenhuis/Composite/MenuComponent.cs b/Pannenkoekenhuis/Composite/MenuComponent.cs new file mode 100644 index 0000000..51bf7fa --- /dev/null +++ b/Pannenkoekenhuis/Composite/MenuComponent.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Composite +{ + public class MenuComponent + { + public MenuComponent component; + + public MenuComponent() + { + + } + + public virtual string DrukAf() + { + if (component != null) + return component.DrukAf(); + else + return ""; + } + + public virtual void VoegToe(MenuComponent m) + { + this.component = m; + } + + public virtual void Verwijder(MenuComponent m) + { + this.component = null; + } + + public MenuComponent Child() + { + return component; + } + } +} diff --git a/Pannenkoekenhuis/Composite/MenuItem.cs b/Pannenkoekenhuis/Composite/MenuItem.cs new file mode 100644 index 0000000..3665712 --- /dev/null +++ b/Pannenkoekenhuis/Composite/MenuItem.cs @@ -0,0 +1,24 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Composite +{ + public class MenuItem : MenuComponent + { + Pannenkoek pannenkoek; + + public MenuItem(Pannenkoek p) + { + this.pannenkoek = p; + } + + public override string DrukAf() + { + return pannenkoek.Beschrijving + "\t ... " + pannenkoek.Prijs; + } + } +} diff --git a/Pannenkoekenhuis/Composite/desktop.ini b/Pannenkoekenhuis/Composite/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Composite/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/Decorators/Champignon.cs b/Pannenkoekenhuis/Decorators/Champignon.cs new file mode 100644 index 0000000..980a4e3 --- /dev/null +++ b/Pannenkoekenhuis/Decorators/Champignon.cs @@ -0,0 +1,16 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Decorators +{ + public class Champignon : PannenkoekDecorator + { + public Champignon(Pannenkoek p) : base(p, "Champignon", 2.0) + { + } + } +} diff --git a/Pannenkoekenhuis/Decorators/Honing.cs b/Pannenkoekenhuis/Decorators/Honing.cs new file mode 100644 index 0000000..8bcc2f8 --- /dev/null +++ b/Pannenkoekenhuis/Decorators/Honing.cs @@ -0,0 +1,16 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Decorators +{ + public class Honing : PannenkoekDecorator + { + public Honing(Pannenkoek p) : base(p, "Honing", 1.3) + { + } + } +} diff --git a/Pannenkoekenhuis/Decorators/Kaas.cs b/Pannenkoekenhuis/Decorators/Kaas.cs new file mode 100644 index 0000000..86602f2 --- /dev/null +++ b/Pannenkoekenhuis/Decorators/Kaas.cs @@ -0,0 +1,16 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Decorators +{ + public class Kaas : PannenkoekDecorator + { + public Kaas(Pannenkoek p) : base(p, "Kaas", 1.5) + { + } + } +} diff --git a/Pannenkoekenhuis/Decorators/PannenkoekDecorator.cs b/Pannenkoekenhuis/Decorators/PannenkoekDecorator.cs new file mode 100644 index 0000000..0c5b12c --- /dev/null +++ b/Pannenkoekenhuis/Decorators/PannenkoekDecorator.cs @@ -0,0 +1,36 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis +{ + public class PannenkoekDecorator : Pannenkoek + { + protected Pannenkoek pannenkoek; + + public PannenkoekDecorator(Pannenkoek p, string beschrijving, double prijs) : base(beschrijving, prijs) + { + this.pannenkoek = p; + this.status = Status.NULL; + } + + public double GetPrijs() + { + return Prijs + (pannenkoek == null ? 0 : pannenkoek.Prijs); + } + + public new string Beschrijving + { + get + { + if (pannenkoek == null) + return Beschrijving + " met "; + else + return pannenkoek.Beschrijving + ", " + Beschrijving; + } + } + } +} diff --git a/Pannenkoekenhuis/Decorators/Stroop.cs b/Pannenkoekenhuis/Decorators/Stroop.cs new file mode 100644 index 0000000..4fc857f --- /dev/null +++ b/Pannenkoekenhuis/Decorators/Stroop.cs @@ -0,0 +1,16 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Decorators +{ + public class Stroop : PannenkoekDecorator + { + public Stroop(Pannenkoek p) : base(p, "Stroop", 0.5) + { + } + } +} diff --git a/Pannenkoekenhuis/Decorators/Suiker.cs b/Pannenkoekenhuis/Decorators/Suiker.cs new file mode 100644 index 0000000..fd48db6 --- /dev/null +++ b/Pannenkoekenhuis/Decorators/Suiker.cs @@ -0,0 +1,16 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Decorators +{ + public class Suiker : PannenkoekDecorator + { + public Suiker(Pannenkoek p) : base(p, "Suiker", 0.3) + { + } + } +} diff --git a/Pannenkoekenhuis/Decorators/Ui.cs b/Pannenkoekenhuis/Decorators/Ui.cs new file mode 100644 index 0000000..51d71c6 --- /dev/null +++ b/Pannenkoekenhuis/Decorators/Ui.cs @@ -0,0 +1,16 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Decorators +{ + public class Ui : PannenkoekDecorator + { + public Ui(Pannenkoek p) : base(p, "Ui", 0.7) + { + } + } +} diff --git a/Pannenkoekenhuis/Decorators/desktop.ini b/Pannenkoekenhuis/Decorators/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Decorators/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/Factory/KaasPannenkoekFactory.cs b/Pannenkoekenhuis/Factory/KaasPannenkoekFactory.cs new file mode 100644 index 0000000..e76aa3a --- /dev/null +++ b/Pannenkoekenhuis/Factory/KaasPannenkoekFactory.cs @@ -0,0 +1,18 @@ +using Pannenkoekenhuis.Decorators; +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Factory +{ + public class KaasPannenkoekFactory : PannenkoekenFactory + { + public override Pannenkoek CreatePannenkoek() + { + return new Kaas(new Pannenkoek("Kaaspannenkoek", 5.00)); + } + } +} diff --git a/Pannenkoekenhuis/Factory/PannenkoekenFactory.cs b/Pannenkoekenhuis/Factory/PannenkoekenFactory.cs new file mode 100644 index 0000000..f809b99 --- /dev/null +++ b/Pannenkoekenhuis/Factory/PannenkoekenFactory.cs @@ -0,0 +1,31 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Factory +{ + public abstract class PannenkoekenFactory + { + public abstract Pannenkoek CreatePannenkoek(); + + public Pannenkoek BestelPannenkoek() + { + Pannenkoek p = CreatePannenkoek(); + + p.Voorbereiden(); + Console.WriteLine(p.status); + p.Bakken(); + Console.WriteLine(p.status); + p.Snijden(); + Console.WriteLine(p.status); + p.Verpakken(); + Console.WriteLine(p.status); + + return p; + } + + } +} diff --git a/Pannenkoekenhuis/Factory/StroopPannenkoekFactory.cs b/Pannenkoekenhuis/Factory/StroopPannenkoekFactory.cs new file mode 100644 index 0000000..fac5a02 --- /dev/null +++ b/Pannenkoekenhuis/Factory/StroopPannenkoekFactory.cs @@ -0,0 +1,18 @@ +using Pannenkoekenhuis.Decorators; +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Factory +{ + public class StroopPannenkoekFactory : PannenkoekenFactory + { + public override Pannenkoek CreatePannenkoek() + { + return new Stroop(new Pannenkoek("Strooppannenkoek", 4.50)); + } + } +} diff --git a/Pannenkoekenhuis/Factory/desktop.ini b/Pannenkoekenhuis/Factory/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Factory/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/Kassabon.cs b/Pannenkoekenhuis/Kassabon.cs new file mode 100644 index 0000000..0078028 --- /dev/null +++ b/Pannenkoekenhuis/Kassabon.cs @@ -0,0 +1,108 @@ +using Pannenkoekenhuis; +using Pannenkoekenhuis.Strategy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Strategy_Kassabon +{ + public class Kassabon + { + private KortingsCalculator korting { get; set; } + + public List pannenkoeken + { + get; private set; + } + + /// + /// Deze klasse realiseert een eenvoudige kassabon voor ons + /// pannenkoekenhuis, en toont hoe het Strategy design pattern kan worden + /// gebruikt. + /// + /// Introductie: + /// Met enige regelmaat worden er nieuwe kortingsacties bedacht, + /// waardoor telkens het algoritme voor het berekenen van korting + /// in deze Kassabon klasse moet worden aangepast. + /// + /// Opgave: + /// Gebruik het Strategy pattern om de algoritmen af te splitsen in + /// aparte klassen onder een gemeenschappelijk interface. + /// + public Kassabon() + { + pannenkoeken = new List(); + korting = new NulKorting(this); + } + + /// + /// Voegt een pannenkoek toe aan de kassabon + /// + /// De Pannenkoek om toe te voegen + public void VoegToe(Pannenkoek p) + { + pannenkoeken.Add(p); + } + + /// + /// Drukt een kassabon af op de console, met daarin opgenomen + /// de beschrijving en prijs van elke pannenkoek op de rekening, + /// de totaalprijs (= som van de prijzen van alle pannenkoeken), + /// de korting (= bedrag dat van de totaalprijs zal worden afgetrokken), + /// en het eindbedrag (= totaalprijs - korting) + /// + public void DrukBonAf() + { + Console.WriteLine("\nKassabon"); + foreach (Pannenkoek p in pannenkoeken) + { + Console.WriteLine("{0} : \t{1,6:F2}", p.Beschrijving, p.Prijs); + } + Console.WriteLine("Totaalprijs : \t{0,6:F2}", Totaalprijs()); + Console.WriteLine("Korting : -\t{0,6:F2}", Korting()); + Console.WriteLine("Eindbedrag = \t{0,6:F2}", Eindbedrag()); + } + + /// + /// Geeft de som van de prijzen van alle pannenkoeken op de kassabon + /// + /// + public double Totaalprijs() + { + double totaalprijs = 0.0; + foreach (Pannenkoek p in pannenkoeken) + { + totaalprijs += p.Prijs; + } + return totaalprijs; + } + + /// + /// Geeft de totaalprijs minus de korting + /// + /// + public double Eindbedrag() + { + double eindbedrag = Totaalprijs() - Korting(); + if (eindbedrag < 0.0) + { + eindbedrag = 0.0; + } + return eindbedrag; + } + + /// + /// Berekent de korting, volgens de actuele kortingsactie(s) + /// + /// Deze kortingsregels veranderen regelmatig, telkens als nieuwe + /// kortingsacties worden bedacht. + /// + /// + public double Korting() + { + return korting.Korting(); + } + } +} diff --git a/Pannenkoekenhuis/KassabonSimpel.png b/Pannenkoekenhuis/KassabonSimpel.png new file mode 100644 index 0000000..8d80b31 Binary files /dev/null and b/Pannenkoekenhuis/KassabonSimpel.png differ diff --git a/Pannenkoekenhuis/Observer/MenuGegevens.cs b/Pannenkoekenhuis/Observer/MenuGegevens.cs new file mode 100644 index 0000000..ca6786b --- /dev/null +++ b/Pannenkoekenhuis/Observer/MenuGegevens.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Observer +{ + interface MenuGegevens + { + void RegistreerMenu(ObserverMenu m); + void VerwijderMenu(ObserverMenu m); + void VerwittigMenus(); + } +} diff --git a/Pannenkoekenhuis/Observer/ObserverMenu.cs b/Pannenkoekenhuis/Observer/ObserverMenu.cs new file mode 100644 index 0000000..f3ba516 --- /dev/null +++ b/Pannenkoekenhuis/Observer/ObserverMenu.cs @@ -0,0 +1,14 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Observer +{ + interface ObserverMenu + { + void Actualiseer(List pannenkoeken); + } +} diff --git a/Pannenkoekenhuis/Observer/OnlineMenu.cs b/Pannenkoekenhuis/Observer/OnlineMenu.cs new file mode 100644 index 0000000..6e35e94 --- /dev/null +++ b/Pannenkoekenhuis/Observer/OnlineMenu.cs @@ -0,0 +1,26 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Observer +{ + class OnlineMenu : ObserverMenu + { + List pannenkoeken; + + public void Actualiseer(List pannenkoeken) + { + this.pannenkoeken = pannenkoeken; + DrukAf(); + } + + public void DrukAf() + { + Console.WriteLine("Online Menu: "); + pannenkoeken.ForEach(p => Console.WriteLine(p.Beschrijving)); + } + } +} diff --git a/Pannenkoekenhuis/Observer/Recepten.cs b/Pannenkoekenhuis/Observer/Recepten.cs new file mode 100644 index 0000000..2243bd9 --- /dev/null +++ b/Pannenkoekenhuis/Observer/Recepten.cs @@ -0,0 +1,47 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Observer +{ + class Recepten : MenuGegevens + { + public List menus; + public List pannenkoeken; + + public Recepten() + { + menus = new List(); + pannenkoeken = new List(); + } + + public void RegistreerMenu(ObserverMenu m) + { + menus.Add(m); + } + + public void VerwijderMenu(ObserverMenu m) + { + menus.Remove(m); + } + + public void VerwittigMenus() + { + foreach (ObserverMenu m in menus) + m.Actualiseer(pannenkoeken); + } + + public void VoegToe(Pannenkoek p) + { + pannenkoeken.Add(p); + } + + public void Verwijder(Pannenkoek p) + { + pannenkoeken.Remove(p); + } + } +} diff --git a/Pannenkoekenhuis/Observer/desktop.ini b/Pannenkoekenhuis/Observer/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Observer/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/Pannenkoek.cs b/Pannenkoekenhuis/Pannenkoek.cs new file mode 100644 index 0000000..fb5731c --- /dev/null +++ b/Pannenkoekenhuis/Pannenkoek.cs @@ -0,0 +1,58 @@ +using Pannenkoekenhuis; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Strategy_Kassabon +{ + /// + /// Een simpele pannenkoek klasse. + /// Een pannenkoek heeft een beschrijving en een prijs, die + /// beide read-only zijn en tijdens constructie worden vastgelegd. + /// + /// In deze eerste versie zijn alle pannenkoeken nog van + /// hetzelfde type, en kunnen er nog geen ingredienten + /// worden toegevoegd. + /// + /// In een volgende versie worden met het Decorator design pattern + /// wrappers voor deze basisklasse gemaakt om ingredienten toe + /// te kunnen voegen. + /// + public class Pannenkoek + { + public enum Status { NULL, VOORBEREIDEN, BAKKEN, SNIJDEN, VERPAKKEN } + public Status status; + + public double Prijs { get; set; } + public string Beschrijving { get; } + + public Pannenkoek(string beschrijving, double prijs) + { + Prijs = prijs; + Beschrijving = beschrijving; + this.status = Status.NULL; + } + + internal void Verpakken() + { + status = Status.VERPAKKEN; + } + + internal void Snijden() + { + status = Status.SNIJDEN; + } + + internal void Bakken() + { + status = Status.BAKKEN; + } + + internal void Voorbereiden() + { + status = Status.VOORBEREIDEN; + } + } +} diff --git a/Pannenkoekenhuis/Pannenkoekenhuis.csproj b/Pannenkoekenhuis/Pannenkoekenhuis.csproj new file mode 100644 index 0000000..204fefa --- /dev/null +++ b/Pannenkoekenhuis/Pannenkoekenhuis.csproj @@ -0,0 +1,102 @@ + + + + + Debug + AnyCPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B} + Exe + Properties + Pannenkoekenhuis + Pannenkoekenhuis + 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/Pannenkoekenhuis/Pannenkoekenhuis.sln b/Pannenkoekenhuis/Pannenkoekenhuis.sln new file mode 100644 index 0000000..370a2e2 --- /dev/null +++ b/Pannenkoekenhuis/Pannenkoekenhuis.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pannenkoekenhuis", "Pannenkoekenhuis.csproj", "{A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8D42246-A7F6-4404-98D5-3FCBA8F13E4B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Pannenkoekenhuis/Program.cs b/Pannenkoekenhuis/Program.cs new file mode 100644 index 0000000..355859c --- /dev/null +++ b/Pannenkoekenhuis/Program.cs @@ -0,0 +1,25 @@ +using Pannenkoekenhuis; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Strategy_Kassabon +{ + class Program + { + static void Main(string[] args) + { + //TestKassabon.TestKassabon1(); + //TestKassabon.TestKassabon2(); + + //TestMenu.TestMenu1(); + + TestFactory.TestFactory1(); + + Console.WriteLine("Druk op Enter..."); + Console.ReadLine(); // Wacht tot de gebruiker op Enter drukt + } + } +} diff --git a/Pannenkoekenhuis/Properties/AssemblyInfo.cs b/Pannenkoekenhuis/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bf57498 --- /dev/null +++ b/Pannenkoekenhuis/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("Pannenkoekenhuis")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Pannenkoekenhuis")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[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("a8d42246-a7f6-4404-98d5-3fcba8f13e4b")] + +// 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/Pannenkoekenhuis/Properties/desktop.ini b/Pannenkoekenhuis/Properties/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Properties/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/Singleton/FactoryFactory.cs b/Pannenkoekenhuis/Singleton/FactoryFactory.cs new file mode 100644 index 0000000..444a7b2 --- /dev/null +++ b/Pannenkoekenhuis/Singleton/FactoryFactory.cs @@ -0,0 +1,31 @@ +using Pannenkoekenhuis.Factory; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Singleton +{ + class FactoryFactory + { + private static PannenkoekenFactory kfactory { get; set; } + + public static PannenkoekenFactory KaasInstance() + { + if (kfactory == null) + kfactory = new KaasPannenkoekFactory(); + return kfactory; + } + + + private static PannenkoekenFactory sfactory { get; set; } + + public static PannenkoekenFactory StroopInstance() + { + if (sfactory == null) + sfactory = new StroopPannenkoekFactory(); + return sfactory; + } + } +} diff --git a/Pannenkoekenhuis/State/EatingState.cs b/Pannenkoekenhuis/State/EatingState.cs new file mode 100644 index 0000000..d403960 --- /dev/null +++ b/Pannenkoekenhuis/State/EatingState.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.State +{ + class EatingState : State + { + public State BrengBestelling() + { + return this; + } + + public State BrengMenuKaart() + { + return new WaitingState(); + } + + public State BrengRekening() + { + return new WaitingState(); + } + + public State DeelWensMee() + { + return new WaitingState(); + } + + public State Instance() + { + return new EatingState(); + } + + public override string ToString() + { + return "Eating"; + } + } +} diff --git a/Pannenkoekenhuis/State/Klant.cs b/Pannenkoekenhuis/State/Klant.cs new file mode 100644 index 0000000..923884a --- /dev/null +++ b/Pannenkoekenhuis/State/Klant.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.State +{ + class Klant + { + State state; + + public Klant() + { + state = new WaitingState(); + } + + public void BrengBestelling() + { + state = state.BrengBestelling(); + Console.WriteLine(state); + } + + public void BrengMenuKaart() + { + state = state.BrengMenuKaart(); + Console.WriteLine(state); + } + + public void BrengRekening() + { + state = state.BrengRekening(); + Console.WriteLine(state); + } + + public void DeelWensMee() + { + state = state.DeelWensMee(); + Console.WriteLine(state); + } + + } +} diff --git a/Pannenkoekenhuis/State/State.cs b/Pannenkoekenhuis/State/State.cs new file mode 100644 index 0000000..3f4c1e8 --- /dev/null +++ b/Pannenkoekenhuis/State/State.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.State +{ + interface State + { + State Instance(); + State DeelWensMee(); + State BrengMenuKaart(); + State BrengBestelling(); + State BrengRekening(); + } +} diff --git a/Pannenkoekenhuis/State/WaitingState.cs b/Pannenkoekenhuis/State/WaitingState.cs new file mode 100644 index 0000000..7c48a89 --- /dev/null +++ b/Pannenkoekenhuis/State/WaitingState.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.State +{ + class WaitingState : State + { + public State BrengBestelling() + { + return new EatingState(); + } + + public State BrengMenuKaart() + { + return this; + } + + public State BrengRekening() + { + return this; + } + + public State DeelWensMee() + { + return this; + } + + public State Instance() + { + return new WaitingState(); + } + + public override string ToString() + { + return "Waiting"; + } + } +} diff --git a/Pannenkoekenhuis/State/desktop.ini b/Pannenkoekenhuis/State/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/State/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/Strategy/KortingsCalculator.cs b/Pannenkoekenhuis/Strategy/KortingsCalculator.cs new file mode 100644 index 0000000..6a7647c --- /dev/null +++ b/Pannenkoekenhuis/Strategy/KortingsCalculator.cs @@ -0,0 +1,21 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Strategy +{ + public abstract class KortingsCalculator + { + protected Kassabon a; + + public KortingsCalculator(Kassabon a) + { + this.a = a; + } + + public abstract double Korting(); + } +} diff --git a/Pannenkoekenhuis/Strategy/NaturelKorting.cs b/Pannenkoekenhuis/Strategy/NaturelKorting.cs new file mode 100644 index 0000000..d0f7d8c --- /dev/null +++ b/Pannenkoekenhuis/Strategy/NaturelKorting.cs @@ -0,0 +1,32 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Strategy +{ + public class NaturelKorting : KortingsCalculator + { + public NaturelKorting(Kassabon a) : base(a) + { } + + public override double Korting() + { + List pannenkoeken = a.pannenkoeken; + + double korting = 0; + + foreach (Pannenkoek p in pannenkoeken) + { + if (p.Beschrijving == "Naturelpannenkoek") + { + korting += p.Prijs * 0.1; + } + } + + return korting; + } + } +} diff --git a/Pannenkoekenhuis/Strategy/NulKorting.cs b/Pannenkoekenhuis/Strategy/NulKorting.cs new file mode 100644 index 0000000..02fde67 --- /dev/null +++ b/Pannenkoekenhuis/Strategy/NulKorting.cs @@ -0,0 +1,20 @@ +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis.Strategy +{ + public class NulKorting : KortingsCalculator + { + public NulKorting(Kassabon a) : base(a) + { } + + public override double Korting() + { + return 0; + } + } +} diff --git a/Pannenkoekenhuis/Strategy/desktop.ini b/Pannenkoekenhuis/Strategy/desktop.ini new file mode 100644 index 0000000..49e4bec --- /dev/null +++ b/Pannenkoekenhuis/Strategy/desktop.ini @@ -0,0 +1,5 @@ +[.ShellClassInfo] +InfoTip=This folder is shared online. +IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe +IconIndex=16 + \ No newline at end of file diff --git a/Pannenkoekenhuis/TestBuilder.cs b/Pannenkoekenhuis/TestBuilder.cs new file mode 100644 index 0000000..49496d0 --- /dev/null +++ b/Pannenkoekenhuis/TestBuilder.cs @@ -0,0 +1,23 @@ +using Pannenkoekenhuis.Builder; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis +{ + class TestBuilder + { + + public static void TestBuilder1() + { + PannenkoekBuilder builder = new PannenkoekBuilder(); + Pannenkoek p = builder.MaakPannenkoek("Spekpannenkoek", 10) + .MetSpek() + .Formaat(17) + .Build(); + } + + } +} diff --git a/Pannenkoekenhuis/TestFactory.cs b/Pannenkoekenhuis/TestFactory.cs new file mode 100644 index 0000000..98cd9e3 --- /dev/null +++ b/Pannenkoekenhuis/TestFactory.cs @@ -0,0 +1,27 @@ +using Pannenkoekenhuis.Factory; +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis +{ + class TestFactory + { + public static void TestFactory1() + { + PannenkoekenFactory factory = new KaasPannenkoekFactory(); + Pannenkoek kaaspannenkoek = factory.BestelPannenkoek(); + + factory = new StroopPannenkoekFactory(); + Pannenkoek strooppannenkoek = factory.BestelPannenkoek(); + + Console.WriteLine(kaaspannenkoek.Beschrijving); + Console.WriteLine(strooppannenkoek.Beschrijving); + + } + + } +} diff --git a/Pannenkoekenhuis/TestKassabon.cs b/Pannenkoekenhuis/TestKassabon.cs new file mode 100644 index 0000000..3120bfb --- /dev/null +++ b/Pannenkoekenhuis/TestKassabon.cs @@ -0,0 +1,31 @@ +using Pannenkoekenhuis.Decorators; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Strategy_Kassabon +{ + /// + /// Testklasse voor het testen van Kassabon. + /// + class TestKassabon + { + public static void TestKassabon1() + { + Kassabon kassabon = new Kassabon(); + kassabon.VoegToe(new Ui(new Champignon(new Pannenkoek("Kaaspannenkoek", 5.50)))); + kassabon.VoegToe(new Pannenkoek("Naturelpannenkoek", 3.75)); + kassabon.VoegToe(new Suiker(new Honing(new Stroop(new Pannenkoek("Appelpannenkoek", 4.80))))); + kassabon.DrukBonAf(); + } + + public static void TestKassabon2() + { + Kassabon kassabon = new Kassabon(); + kassabon.VoegToe(new Pannenkoek("Kaas-spek-pannenkoek", 6.95)); + kassabon.DrukBonAf(); + } + } +} diff --git a/Pannenkoekenhuis/TestMenu.cs b/Pannenkoekenhuis/TestMenu.cs new file mode 100644 index 0000000..4f1f3a3 --- /dev/null +++ b/Pannenkoekenhuis/TestMenu.cs @@ -0,0 +1,44 @@ +using Pannenkoekenhuis.Composite; +using Pannenkoekenhuis.Decorators; +using Strategy_Kassabon; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis +{ + class TestMenu + { + public static void TestMenu1() + { + Menu m = new Menu("Pannenkoeken"); + + Menu kindermenu = new Menu("Kinder Menu"); + Menu snelmenu = new Menu("Snel Menu"); + Menu alles = new Menu("Alles"); + + MenuItem naturelpannenkoek = new MenuItem(new Pannenkoek("Naturel Pannenkoek", 3.00)); + MenuItem champignonpannekoek = new MenuItem(new Champignon(new Ui(new Pannenkoek("Champignon Pannenkoek", 6.00)))); + MenuItem zoetepannenkoek = new MenuItem(new Honing(new Suiker(new Stroop(new Pannenkoek("Zoete Pannenkoek", 10.00))))); + MenuItem strooppannenkoek = new MenuItem(new Stroop(new Pannenkoek("Stroop Pannenkoek", 3.50))); + + snelmenu.VoegToe(naturelpannenkoek); + snelmenu.VoegToe(champignonpannekoek); + + kindermenu.VoegToe(zoetepannenkoek); + kindermenu.VoegToe(strooppannenkoek); + + alles.VoegToe(snelmenu); + alles.VoegToe(kindermenu); + + m.VoegToe(snelmenu); + m.VoegToe(kindermenu); + m.VoegToe(alles); + + Console.WriteLine(m.DrukAf()); + } + + } +} diff --git a/Pannenkoekenhuis/TestSingleton.cs b/Pannenkoekenhuis/TestSingleton.cs new file mode 100644 index 0000000..85e50f9 --- /dev/null +++ b/Pannenkoekenhuis/TestSingleton.cs @@ -0,0 +1,19 @@ +using Pannenkoekenhuis.Factory; +using Pannenkoekenhuis.Singleton; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis +{ + class TestSingleton + { + + public static void TestSingleton1() + { + PannenkoekenFactory f = FactoryFactory.KaasInstance(); + } + } +} diff --git a/Pannenkoekenhuis/TestState.cs b/Pannenkoekenhuis/TestState.cs new file mode 100644 index 0000000..325dffd --- /dev/null +++ b/Pannenkoekenhuis/TestState.cs @@ -0,0 +1,21 @@ +using Pannenkoekenhuis.State; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pannenkoekenhuis +{ + class TestState + { + public static void TestState1() + { + Klant k = new Klant(); + k.BrengMenuKaart(); + k.DeelWensMee(); + k.BrengBestelling(); + k.BrengRekening(); + } + } +}