LagerSystem

This commit is contained in:
Geir Okkenhaug Jerstad 2025-01-08 13:37:24 +01:00
parent 85921091f9
commit 5e0cdf8850
8 changed files with 103 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}") = "Lagerstyringssystem", "Lagerstyringssystem\Lagerstyringssystem.csproj", "{A3AEB290-4543-4552-BF61-7AEB4C95A6F1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A3AEB290-4543-4552-BF61-7AEB4C95A6F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3AEB290-4543-4552-BF61-7AEB4C95A6F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3AEB290-4543-4552-BF61-7AEB4C95A6F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3AEB290-4543-4552-BF61-7AEB4C95A6F1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,13 @@
namespace Lagerstyringssystem;
public class Elektronikk: IProdukt
{
public string Navn { get; set; }
public double Pris { get; set; }
int Garantitid { get; set; }
public void SkrivUtInfo() {
Console.WriteLine($"Navn: {Navn}\nPris: {Pris}\nGarantitid: {Garantitid}");
}
}

View file

@ -0,0 +1,9 @@
namespace Lagerstyringssystem;
public interface IProdukt
{
string Navn { get; set; }
double Pris { get; set; }
void SkrivUtInfo();
}

View file

@ -0,0 +1,13 @@
namespace Lagerstyringssystem;
public class Klær: IProdukt
{
public string Navn { get; set; }
public double Pris { get; set; }
public string Størrelse { get; set; }
public void SkrivUtInfo()
{
throw new NotImplementedException();
}
}

View file

@ -0,0 +1,25 @@
namespace Lagerstyringssystem;
public class Lager
{
List<IProdukt> Inventar { get; set; }
void Add(IProdukt produkt)
{
Inventar.Add(produkt);
}
void Remove(IProdukt produkt)
{
Inventar.Remove(produkt);
}
void ListAll(List<IProdukt> inventar)
{
foreach (IProdukt produkt in inventar)
{
produkt.SkrivUtInfo();
}
}
}

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>

View file

@ -0,0 +1,14 @@
namespace Lagerstyringssystem;
public class Matvare: IProdukt
{
public string Navn { get; set; }
public double Pris { get; set; }
public DateTime Utløpsdato { get; set; }
public void SkrivUtInfo()
{
throw new NotImplementedException();
}
}

View file

@ -0,0 +1,3 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");