Interfaces + Bugfix Klassen

This commit is contained in:
2024-07-23 08:27:59 +02:00
parent 7f5fedfe16
commit 9fc4489559
7 changed files with 166 additions and 16 deletions

View File

@@ -8,7 +8,7 @@ namespace Exercises_C_Sharp.E28_Classes
{
public static void Start()
{
List<Lists> listList = new List<Lists>();
List<Lists> listList = new();
//Erstellen Sie fünf neue Instanzen der Klasse Lists und fügen Sie diese der oberen Liste hinzu.
//Code START
@@ -21,12 +21,14 @@ namespace Exercises_C_Sharp.E28_Classes
//Sollte sich das Element in einer Liste befinden, dann geben Sie den Wert davor und den Wert danach aus. Sollte es keinen Wert davor bzw. danach geben, nehmen Sie den letzten oder den ersten Wert.
while(true)
{
//Code START
//Code ENDE
}
}
static void fillListsWithRandomValues(Lists lis)
{
Random rand = new Random();
Random rand = new();
//Fill Integer
for(int i = 0; i < rand.Next(5, 21); i++)
lis.IntegerList.Add(rand.Next());
@@ -53,9 +55,9 @@ namespace Exercises_C_Sharp.E28_Classes
}
class Lists
{
public List<int> IntegerList = new List<int>();
public List<string> StringList = new List<string>();
public List<char> CharList = new List<char>();
public List<decimal> DecimalList = new List<decimal>();
public List<int> IntegerList = new();
public List<string> StringList = new();
public List<char> CharList = new();
public List<decimal> DecimalList = new();
}
}

View File

@@ -27,10 +27,15 @@ namespace Exercises_C_Sharp.E28_Classes
//Geben Sie in diser Methode alle Ausweise optisch ansprechend auf der Konsole aus.
static void ShowIDs(List<ID> idList)
{
//Code START
//Code ENDE
}
//Sorgen Sie dafür, dass der Anwender hier einen validen Ausweis erstellen kann. Setzen Sie die IDNumber selber. Achten Sie darauf, dass eine IDNumber mindesten 5 Zahlen beinhaltet und eindeutig sein muss.
//Code START
//Code ENDE
static ID UserCreateID()
{
//Code START
@@ -39,6 +44,9 @@ namespace Exercises_C_Sharp.E28_Classes
}
//Code START
//Code ENDE
}
class ID

View File

@@ -6,9 +6,9 @@ namespace Exercises_C_Sharp.E28_Classes
{
class Exercise_7
{
static List<Customer> CustomerList = new List<Customer>();
static List<Product> ProductList = new List<Product>();
static List<Invoice> InvoiceList = new List<Invoice>();
static List<Customer> CustomerList = new();
static List<Product> ProductList = new();
static List<Invoice> InvoiceList = new();
public static void Start()
{
while(true)