w3c rektangel

This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-14 14:50:35 +01:00
parent 655eca3ccf
commit 3df0f671b8
3 changed files with 67 additions and 0 deletions

View file

@ -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

View file

@ -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();
}
}
}

View file

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