Advertisement
MeckeOfficial

ErstesProgramm

Sep 8th, 2017
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 KB | None | 0 0
  1. //  Program.cs
  2. //  _________________________________
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9.  
  10. namespace ErstesProgramm
  11. {
  12.     class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.             Console.WriteLine("Wie alt ist dein Auto?");
  17.             int a;
  18.             a = Int32.Parse(Console.ReadLine());
  19.  
  20.  
  21.             Console.WriteLine("Von welcher Marke ist dein Auto?");
  22.             string b;
  23.             b = Console.ReadLine();
  24.  
  25.             Console.WriteLine("Wieviel PS hat dein Auto?");
  26.             int c;
  27.             c = Int32.Parse(Console.ReadLine());
  28.  
  29.             Car newcar = new Car(a, b, c);
  30.        
  31.             Console.ReadKey();
  32.         }
  33.     }
  34. }
  35.  
  36. //  __________________________
  37. //  Car.cs
  38. //  __________________________
  39.  
  40. using System;
  41. using System.Collections.Generic;
  42. using System.Linq;
  43. using System.Text;
  44. using System.Threading.Tasks;
  45.  
  46. namespace ErstesProgramm
  47. {
  48.     class Car
  49.     {
  50.         public int alter;
  51.         public string marke;
  52.         public int power;
  53.  
  54.         public Car(int alter, string marke, int power)
  55.         {
  56.  
  57.             this.alter = alter;
  58.             this.marke = marke;
  59.             this.power = power;
  60.  
  61.             this.GetInfo();
  62.  
  63.             Console.WriteLine("   ");
  64.             Console.WriteLine("wird gespawned...   ");
  65.             Console.WriteLine("   ");
  66.  
  67.             this.Spawn();
  68.         }
  69.  
  70.         public void GetInfo()
  71.         {
  72.             Console.WriteLine("Der " + marke + " hat " + power + " PS und ist " + alter + " Jahre alt.");
  73.         }
  74.  
  75.         public void Spawn()
  76.         {
  77.             Console.WriteLine("Der " + marke + " mit " + power + " PS wurde erfolgreich in der Garage gespawnt.");
  78.         }
  79.  
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement