From 3df0f671b8cd2c65c16cb57fe30cf6a672881f0e Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Thu, 14 Nov 2024 14:50:35 +0100 Subject: [PATCH] w3c rektangel --- Emne 3/ConsoleApp6/ConsoleApp6.sln | 16 ++++++++ Emne 3/ConsoleApp6/w3cRectangle/Program.cs | 41 +++++++++++++++++++ .../w3cRectangle/w3cRectangle.csproj | 10 +++++ 3 files changed, 67 insertions(+) create mode 100644 Emne 3/ConsoleApp6/ConsoleApp6.sln create mode 100644 Emne 3/ConsoleApp6/w3cRectangle/Program.cs create mode 100644 Emne 3/ConsoleApp6/w3cRectangle/w3cRectangle.csproj diff --git a/Emne 3/ConsoleApp6/ConsoleApp6.sln b/Emne 3/ConsoleApp6/ConsoleApp6.sln new file mode 100644 index 0000000..27c68b6 --- /dev/null +++ b/Emne 3/ConsoleApp6/ConsoleApp6.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "w3cRectangle", "w3cRectangle\w3cRectangle.csproj", "{1A5EE44F-A5A5-48F7-9AC4-5B8CCE783322}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1A5EE44F-A5A5-48F7-9AC4-5B8CCE783322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1A5EE44F-A5A5-48F7-9AC4-5B8CCE783322}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1A5EE44F-A5A5-48F7-9AC4-5B8CCE783322}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1A5EE44F-A5A5-48F7-9AC4-5B8CCE783322}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Emne 3/ConsoleApp6/w3cRectangle/Program.cs b/Emne 3/ConsoleApp6/w3cRectangle/Program.cs new file mode 100644 index 0000000..8d4a022 --- /dev/null +++ b/Emne 3/ConsoleApp6/w3cRectangle/Program.cs @@ -0,0 +1,41 @@ +using System; + +namespace RectangleApplication +{ + class Rectangle + { + // Member values + double length; + double width; + + public void Acceptdetails() + { + length = 4.5; + width = 3.5; + } + + public double GetArea() + { + return length * width; + } + + public void Display() + { + Console.WriteLine("Length: {0}", length); + Console.WriteLine("Width: {0}", width); + Console.WriteLine("Area: {0}", GetArea()); + } + } + + class ExecuteRectangle + { + static void Main(string[] args) + { + Rectangle r = new Rectangle(); + r.Acceptdetails(); + r.Display(); + Console.ReadLine(); + } + } +} + diff --git a/Emne 3/ConsoleApp6/w3cRectangle/w3cRectangle.csproj b/Emne 3/ConsoleApp6/w3cRectangle/w3cRectangle.csproj new file mode 100644 index 0000000..2f4fc77 --- /dev/null +++ b/Emne 3/ConsoleApp6/w3cRectangle/w3cRectangle.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + +