Projektdateien hinzufügen.

This commit is contained in:
2023-03-23 12:24:40 +01:00
parent 5fe92f4f47
commit 33e49f846c
51 changed files with 1444 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using System;
using System.Security.Principal;
namespace Person_03_03_2023
{
internal class Program
{
static void Main(string[] args)
{
Person person = new Person();
Console.WriteLine("Bitte stell dich vor. ");
person.SetName(Console.ReadLine());
Console.WriteLine("{0} bitte sag uns bitte dein alter.", person.GetName());
person.SetAge(Convert.ToInt32(Console.ReadLine()));
Console.WriteLine("{0} bitte sag uns noch wann dein Geburtstag ist.", person.GetName());
person.SetDay(Console.ReadLine());
}
}
class Person
{
private string name;
private int age;
private string day;
public string GetName()
{ return name; }
public void SetName(string n)
{ name = n; }
public int GetAge()
{
if (string.IsNullOrEmpty(day))
{ return age; }
else
{ return age + 1; }
}
public void SetAge(int a)
{ age = a; }
public void SetDay(string d)
{ day = d; }
public string GetDay()
{ return day; }
public void AusGabe()
{
if (string.IsNullOrEmpty(GetDay()))
{ Console.WriteLine($"{GetName()} leider hattest du noch kein Geburtstag {GetAge()}."); }
else
{ Console.WriteLine($"{GetName()} du bist ein Jahr älter als du angegeben hast {GetAge()}."); }
}
}
}

View 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>