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,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeispielKomposition
{
internal class Building
{
private string name;
private Floor[] floors;
public Building(string name, int floors)
{
this.name = name;
this.floors = new Floor[floors];
for (int i = 0; i < this.floors.Length; i++)
{
this.floors[i] = new Floor(i);
}
}
public void PrintInfos()
{
Console.WriteLine($"Gebäude {name}:");
foreach (Floor floor in floors)
{
Console.WriteLine("Etage " + floor.GetFloorid());
}
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeispielKomposition
{
internal class Floor
{
private int floorid;
public Floor(int floorid)
{ this.floorid = floorid; }
public int GetFloorid() { return floorid; }
}
}

View File

@@ -0,0 +1,12 @@
namespace BeispielKomposition
{
internal class Program
{
static void Main(string[] args)
{
Building b1 = new Building ("Trump-Tower", 15);
b1.PrintInfos();
}
}
}