using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Moped { internal class Moped { protected string licencePlate; protected int odometer; protected int seats; public Moped() : this("Bit-LC 1", false) { } public Moped(bool IsSportModel) : this("BIT-LC 1", IsSportModel) { } public Moped(string licenePlate) : this(licenePlate, false) { } public Moped(string licencePlate, bool IsSportModel) { this.licencePlate = licencePlate; this.seats = IsSportModel ? 1 : 0; } //public Moped(int kilometerstand, bool isSportModel) //{ // this.licencePlate = "BIT-LC 1"; // this.odometer = kilometerstand; // this.seats = isSportModel ? 1 : 2; //} //public Moped(string kennzeichen, int kilometerstand, bool isSportModel) //{ // this.licencePlate = kennzeichen; // this.odometer = kilometerstand; // this.seats = isSportModel ? 1 : 2; //} public void Drive(int x) { this.odometer += x; Console.WriteLine($"Das Moped fährt {x} Kilometer."); } public string GetLicensePlatte() { return this.licencePlate; } public int GetOdometer() { return this.odometer; } public int GetSeats() { if (seats == 1) { return this.seats = 1; } else { return this.seats = 2; } } public virtual void GetInfos() { Console.WriteLine($"Kennzeichen: {GetLicensePlatte()}"); Console.WriteLine($"Kilometer: {GetOdometer()}"); Console.WriteLine($"Sitzsplätze: {GetSeats()}"); } //public virtual void GetInfos() //{ // Console.WriteLine($"Das Moped hat folgendes Kennzeichen:{licencePlate}"); // Console.WriteLine($"Das Moped hat folgenden Kilometerstand:{odometer}"); // if (this.seats == 1) // { // Console.WriteLine($"Sport Moped hat nur 1 Sitzsplatz"); // } // else // { // Console.WriteLine($"Normale Mopeds haben 2 Sitzpätze"); // } //} } }