add Programmyday form github
This commit is contained in:
16
warehouse/Program.cs
Normal file
16
warehouse/Program.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace warehouse
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
|
||||
Warehouse bestand = new Warehouse("test", 20, 80, 100034);
|
||||
bestand.PrintInfo();
|
||||
bestand.Verkauf();
|
||||
bestand.Einkauf();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
10
warehouse/warehouse.csproj
Normal file
10
warehouse/warehouse.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
54
warehouse/warenhaus.cs
Normal file
54
warehouse/warenhaus.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace warehouse
|
||||
{
|
||||
internal class Warehouse
|
||||
{
|
||||
private string name;
|
||||
|
||||
private int warenbestand;
|
||||
private int kassenbestand;
|
||||
|
||||
public Warehouse(string name, int filialen, int warenbestand, int kassenbestand)
|
||||
{
|
||||
this.name = name;
|
||||
this.warenbestand = warenbestand;
|
||||
this.kassenbestand = kassenbestand;
|
||||
}
|
||||
public void Einkauf()
|
||||
{
|
||||
if (this.kassenbestand >= 10)
|
||||
{
|
||||
this.kassenbestand -= 10;
|
||||
this.warenbestand++;
|
||||
Console.WriteLine($"Kauf ist erfolgt");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Kauf konnte nicht durchgeführt werden.");
|
||||
}
|
||||
}
|
||||
public void Verkauf()
|
||||
{
|
||||
if (this.warenbestand > 0)
|
||||
{
|
||||
this.kassenbestand += 20;
|
||||
this.warenbestand--;
|
||||
Console.WriteLine("Ware wurde verkauft.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Keine Ware vorhanden.");
|
||||
}
|
||||
}
|
||||
public void PrintInfo()
|
||||
{
|
||||
Console.Write($"Name der Kette: {this.name}, Der Warenbestand beträgt: {this.warenbestand} der Kassenbestand beträgt: {this.kassenbestand}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user