add Programmyday form github
This commit is contained in:
58
Capitalize/JobVerwaltung.cs
Normal file
58
Capitalize/JobVerwaltung.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jobs
|
||||
{
|
||||
internal class JobVerwaltung
|
||||
{
|
||||
private Queue<Jobs> jobsQue = new Queue<Jobs>();
|
||||
public void AddJob(Jobs jobs)
|
||||
{
|
||||
jobsQue.Enqueue(jobs);
|
||||
int jobId = jobsQue.Count();
|
||||
if (jobId > 1)
|
||||
{
|
||||
Console.WriteLine($"Es sind noch {jobId} Jobs offen");
|
||||
Console.WriteLine("-----------------------------------");
|
||||
Console.WriteLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Es ist noch {jobId} Job offen.");
|
||||
Console.WriteLine("-----------------------------------");
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
public void GetJobDone()
|
||||
{
|
||||
if (jobsQue.Count() == 0)
|
||||
{
|
||||
Console.WriteLine("Es sind keine Jobs mehr vorhanden.");
|
||||
Console.WriteLine("-----------------------------------");
|
||||
Console.WriteLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
Jobs nextJobs = jobsQue.Dequeue();
|
||||
Console.WriteLine($"Nächst Job ist {nextJobs}");
|
||||
int jobId = jobsQue.Count();
|
||||
Console.WriteLine($"Es sind noch {jobId} offen");
|
||||
Console.WriteLine("-----------------------------------");
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
public void ShowAllJobs()
|
||||
{
|
||||
Console.WriteLine("Alle vorhandenen Jobs: ");
|
||||
foreach (Jobs jobs in jobsQue)
|
||||
{
|
||||
Console.WriteLine($"Folgende Jobs stehen noch aus: {jobs.GetBezeichnung()}");
|
||||
Console.WriteLine($"Der auftrag kommt von: {jobs.GetAuftraggeber()}");
|
||||
Console.WriteLine($"Und wird in der Zeit von: {jobs.GetDauer()} Minuten bearbeitet");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Capitalize/Jobs.cs
Normal file
33
Capitalize/Jobs.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jobs
|
||||
{
|
||||
internal class Jobs
|
||||
{
|
||||
private string? bezeichnung;
|
||||
private string? auftraggeber;
|
||||
private int dauer;
|
||||
public Jobs(string jobBezeinung, string auftraggeber, int dauer)
|
||||
{
|
||||
this.bezeichnung = jobBezeinung;
|
||||
this.auftraggeber = auftraggeber;
|
||||
this.dauer = dauer;
|
||||
}
|
||||
public string GetBezeichnung()
|
||||
{
|
||||
return this.bezeichnung;
|
||||
}
|
||||
public string GetAuftraggeber()
|
||||
{
|
||||
return this.auftraggeber;
|
||||
}
|
||||
public int GetDauer()
|
||||
{
|
||||
return this.dauer;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Capitalize/Jobs.csproj
Normal file
10
Capitalize/Jobs.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>
|
||||
18
Capitalize/Program.cs
Normal file
18
Capitalize/Program.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Channels;
|
||||
|
||||
namespace Jobs
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
JobVerwaltung jobs = new JobVerwaltung();
|
||||
jobs.AddJob(new Jobs("print","office",104));
|
||||
jobs.AddJob(new Jobs("Menu","ich",80));
|
||||
jobs.AddJob(new Jobs("Kaffee kochen","der Chef mir",8));
|
||||
jobs.GetJobDone();
|
||||
jobs.ShowAllJobs();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user