Advertisement
MBrendecke

Konto_20180519

May 19th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System.Text;
  2. using static System.Console;
  3.  
  4. namespace Konto
  5. {
  6.     internal class Program
  7.     {
  8.         private static void Main(string[] args)
  9.         {
  10.             Konto ktn = new Konto()
  11.             {
  12.                 Kontonummer = 1234567890,
  13.                 Kontoinhaber = "Max Mustermann",
  14.                 Saldo = 0,
  15.                 Kreditlimit = 100
  16.             };
  17.  
  18.             Clear();
  19.             OutputEncoding = Encoding.UTF8;
  20.             WriteLine(ktn);
  21.             ReadLine();
  22.         }
  23.     }
  24.  
  25.     public class Konto
  26.     {
  27.         public long Kontonummer { get; set; }
  28.         public string Kontoinhaber { get; set; }
  29.         public decimal Saldo { get; set; }
  30.         public decimal Kreditlimit { get; set; }
  31.  
  32.         protected virtual string Ausgabe()
  33.         {
  34.             return $@"
  35. Kontonummer: {Kontonummer}
  36. Kontoinhaber: {Kontoinhaber}
  37. Saldo: {Saldo:C}
  38. Kreditlimit: {Kreditlimit:C}
  39. ";
  40.         }
  41.  
  42.         public override string ToString()
  43.         {
  44.             return this.Ausgabe();
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement