06.11.2026
This commit is contained in:
+3
-1
@@ -1,3 +1,5 @@
|
||||
/Homepage/Portfolio.zip
|
||||
/Homepage/Screenshots/*
|
||||
/C#_HelloWorld/ConsoleApp1/.vs/
|
||||
/C#_HelloWorld/ConsoleApp1/.vs/*
|
||||
/C#_HelloWorld/ConsoleApp1/ConsoleApp1/bin/*
|
||||
/C#_HelloWorld/ConsoleApp1/ConsoleApp1/obj/*
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
internal class Angestellter : Person
|
||||
{
|
||||
private int employeeID = 0;
|
||||
|
||||
|
||||
public Angestellter(string _firstName, string _lastName, DateTime _birthDay, int _employeeID) : base (_firstName, _lastName, _birthDay)
|
||||
{
|
||||
this.employeeID = _employeeID;
|
||||
}
|
||||
|
||||
public void getMitarbeiterInfo()
|
||||
{
|
||||
int userage = base.getAge();
|
||||
string consoleLine = string.Format("Der Mitarbeiter mit der Mitarbeiternummer {0} lautet {1} {2} und ist {3} Jahre alt.", this.employeeID, this.firstName, this.lastName, userage);
|
||||
Console.WriteLine(consoleLine);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
internal class Kunde : Person
|
||||
{
|
||||
private int kdnr = 0;
|
||||
|
||||
public Kunde(string _firstName, string _lastName, DateTime _birthDay, int _kdnr) : base(_firstName, _lastName, _birthDay)
|
||||
{
|
||||
this.kdnr = _kdnr;
|
||||
}
|
||||
|
||||
|
||||
public void getKundenInfo()
|
||||
{
|
||||
int userage = base.getAge();
|
||||
string consoleLine = string.Format("Der Kunde mit der Kundennummer {0} lautet {1} {2} und ist {3} Jahre alt.", this.kdnr, this.firstName, this.lastName, userage);
|
||||
Console.WriteLine(consoleLine);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,18 +8,18 @@ namespace ConsoleApp1
|
||||
|
||||
internal class Person
|
||||
{
|
||||
private string firstName;
|
||||
private string lastName;
|
||||
private DateTime birthDay;
|
||||
protected string firstName;
|
||||
protected string lastName;
|
||||
protected DateTime birthDay;
|
||||
|
||||
Person(string _firstName, string _lastName, DateTime _birthDay)
|
||||
public Person(string _firstName, string _lastName, DateTime _birthDay)
|
||||
{
|
||||
this.firstName = _firstName;
|
||||
this.lastName = _lastName;
|
||||
this.birthDay = _birthDay;
|
||||
}
|
||||
|
||||
private int getAge()
|
||||
protected int getAge()
|
||||
{
|
||||
DateTime curentTIme = DateTime.Now;
|
||||
int age = curentTIme.Year - birthDay.Year;
|
||||
|
||||
@@ -23,10 +23,16 @@ namespace ConsoleApp1
|
||||
birthDay = Console.ReadLine();
|
||||
|
||||
string[] birthDaySplit = birthDay.Split(".");
|
||||
DateTime defineBirthday = DateTime.Parse("",
|
||||
DateTime defineBirthday = DateTime.ParseExact(String.Format("{0}-{1}-{2}", birthDaySplit[2], birthDaySplit[1], birthDaySplit[0]), "yyyy-MM-dd", null);
|
||||
|
||||
|
||||
var p1 = new Kunde(firstName, lastName, defineBirthday, 107);
|
||||
p1.printInfo();
|
||||
p1.getKundenInfo();
|
||||
|
||||
var p2 = new Angestellter(firstName, lastName, defineBirthday, 789);
|
||||
p2.printInfo();
|
||||
p2.getMitarbeiterInfo();
|
||||
|
||||
|
||||
//TestMysqlConnection();
|
||||
|
||||
Reference in New Issue
Block a user