Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program.cs
- // _________________________________
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ErstesProgramm
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Wie alt ist dein Auto?");
- int a;
- a = Int32.Parse(Console.ReadLine());
- Console.WriteLine("Von welcher Marke ist dein Auto?");
- string b;
- b = Console.ReadLine();
- Console.WriteLine("Wieviel PS hat dein Auto?");
- int c;
- c = Int32.Parse(Console.ReadLine());
- Car newcar = new Car(a, b, c);
- Console.ReadKey();
- }
- }
- }
- // __________________________
- // Car.cs
- // __________________________
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ErstesProgramm
- {
- class Car
- {
- public int alter;
- public string marke;
- public int power;
- public Car(int alter, string marke, int power)
- {
- this.alter = alter;
- this.marke = marke;
- this.power = power;
- this.GetInfo();
- Console.WriteLine(" ");
- Console.WriteLine("wird gespawned... ");
- Console.WriteLine(" ");
- this.Spawn();
- }
- public void GetInfo()
- {
- Console.WriteLine("Der " + marke + " hat " + power + " PS und ist " + alter + " Jahre alt.");
- }
- public void Spawn()
- {
- Console.WriteLine("Der " + marke + " mit " + power + " PS wurde erfolgreich in der Garage gespawnt.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement