Commit 3e4a29d6 authored by Uwe Wienkop's avatar Uwe Wienkop

2020-01-13

parent e16f748b
......@@ -7,7 +7,7 @@ namespace _12DiesUndDas
public string name; // name kommt pro Personenobj. vor
readonly int persId; // persID kommt pro Personenobj. vor
static int naechsteID = 1; // static-Datenfelder kommen nur
public static int naechsteID { get; } = 1; // static-Datenfelder kommen nur
// EINMAL PRO KLASSE vor
static Person[] pFeld = new Person[1000];
......@@ -18,6 +18,14 @@ namespace _12DiesUndDas
pFeld[naechsteID - 1] = this; // this ~ das gesamte aktuelle Objekt
naechsteID++;
}
public void xxx(Person[] pFeld)
{
Person p = null;
for (int i = 0; i < length; i++)
{
p = pFeld[i];
}
}
}
class Program
{
......
......@@ -7,16 +7,48 @@ namespace _12Speisekarte
{
static void Main(string[] args)
{
StreamReader sr = new StreamReader(@"..\..\..\Speisekarte.txt");
string dateiname = @"..\..\..\Speisekarte.txt";
StreamReader sr = new StreamReader(dateiname);
while (!sr.EndOfStream)
{
//Console.WriteLine(sr.ReadLine());
string zeile = sr.ReadLine();
string[] daten = zeile.Split(';');
string[] daten = zeile.Split(';', '€');
double preis = Convert.ToDouble(daten[2]);
Console.WriteLine($"Kürzel: {daten[0]}, Text: {daten[1],40}, Preis: {preis,10:f2}");
}
sr.Close();
Konto[] kontenfeld;
kontenfeld = new Konto[111];
double zinsen;
Kontenlesen("bla.txt", out kontenfeld, out zinsen);
}
static void Kontenlesen(string dateiname,
out Konto[] konten, out double gesZinsen)
{
StreamReader sr = new StreamReader(dateiname);
int anz = Convert.ToInt32(sr.ReadLine());
konten = new Konto[anz];
gesZinsen = 0.0;
string[] daten = new string[3];
for (int i = 0; i < anz; i++)
{
string zeile = sr.ReadLine();
daten = zeile.Split(';');
double betrag = Convert.ToDouble(daten[2]);
konten[i] = new Konto(daten[0], Convert.ToInt32(daten[1]), betrag);
gesZinsen += konten[i].Zinsen();
Console.WriteLine($"Kürzel: {daten[0]}, Text: {daten[1],40}, Preis: {preis,10:f2}");
}
sr.Close();
}
}
class Konto
{
public Konto(string name, int kontonr, double guthaben) // Konstruktor
{ }
public double Zinsen() // Zinsen berechnen
{ return -4711; }
}
}
S1;Peking Suppe;3,00
S1;Peking Suppe;3,00
S2;Miso Suppe;2,90
V1;Frühlingsrolle;3,10
V2;Krabbenchips (Krupuk);2,80
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>_13DiesUndDas</RootNamespace>
</PropertyGroup>
</Project>
using System;
namespace _13DiesUndDas
{
enum Ampelfarben1 { rot,gelb,grün};
class Kreuzung1
{
Ampelfarben1 ampel;
public Kreuzung1 (Ampelfarben1 Ampel)
{
ampel = Ampel;
}
}
class Kreuzung2
{
public enum Ampelfarben2 { rot,gelb,grün};
Ampelfarben2 ampel;
public Kreuzung2(Ampelfarben2 Ampel)
{
ampel = Ampel;
}
}
class Program
{
static void Main(string[] args)
{
Kreuzung1 k1 = new Kreuzung1(Ampelfarben1.rot);
Kreuzung2 k2 = new Kreuzung2(Kreuzung2.Ampelfarben2.rot);
}
}
}
......@@ -101,9 +101,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "11KlasseBug", "11KlasseBug\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "11WPFDemo", "11WPFDemo\11WPFDemo.csproj", "{C04747AC-2F30-40F2-9B27-197259FACAF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "12DiesUndDas", "12DiesUndDas\12DiesUndDas.csproj", "{946601F3-87FE-4861-BEE6-A04D3B385F1B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "12DiesUndDas", "12DiesUndDas\12DiesUndDas.csproj", "{946601F3-87FE-4861-BEE6-A04D3B385F1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "12Speisekarte", "12Speisekarte\12Speisekarte.csproj", "{F6CC9544-5B04-45F0-8452-E23C24A86710}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "12Speisekarte", "12Speisekarte\12Speisekarte.csproj", "{F6CC9544-5B04-45F0-8452-E23C24A86710}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13DiesUndDas", "13DiesUndDas\13DiesUndDas.csproj", "{73771505-B732-4670-AB97-97DFED42C2E0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -315,6 +317,10 @@ Global
{F6CC9544-5B04-45F0-8452-E23C24A86710}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6CC9544-5B04-45F0-8452-E23C24A86710}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6CC9544-5B04-45F0-8452-E23C24A86710}.Release|Any CPU.Build.0 = Release|Any CPU
{73771505-B732-4670-AB97-97DFED42C2E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73771505-B732-4670-AB97-97DFED42C2E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73771505-B732-4670-AB97-97DFED42C2E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73771505-B732-4670-AB97-97DFED42C2E0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment