Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- namespace Proj_obj_samochod
- {
- [Serializable()]
- public class Samochod
- {
- private string marka;
- private string model;
- private Silnik silnik;
- public Samochod()
- {
- }
- public Samochod(string marka, string model, Silnik silnik)
- {
- this.marka = marka;
- this.model = model;
- this.silnik = silnik;
- }
- public Samochod(string marka, string model, int pojemnosc, int paliwo)
- {
- this.marka = marka;
- this.model = model;
- this.silnik = new Silnik(pojemnosc, paliwo);
- }
- public Samochod(string marka, string model, double pojemnosc, int paliwo, int zbiornik)
- {
- this.marka = marka;
- this.model = model;
- this.silnik = new Silnik(pojemnosc, paliwo, zbiornik);
- }
- public void Jedz(int nowyDystans)
- {
- int czas = nowyDystans * 100;
- int x = 0;
- for (int i = 0; i < 10; i++, x += 10)
- {
- this.silnik.Dzialaj();
- Console.Clear();
- Console.WriteLine("Jade");
- Console.WriteLine(silnik.StanPaliwa());
- Console.WriteLine(@" /|_||_\`.__".PadLeft(x));
- Console.WriteLine(@"( _ _ _\".PadLeft(x + 1));
- Console.WriteLine(@"=`-(_)--(_)-'".PadLeft(x + 1));
- Thread.Sleep(czas / 10);
- }
- Console.WriteLine("Jestem");
- }
- public string InformacjeOSamochodzie()
- {
- return $"Marka: {this.marka}\nModel: {this.model}\n{this.silnik.InformacjeOSilniku}";
- }
- public void Zatankuj()
- {
- Console.WriteLine(this.silnik.StanPaliwa());
- this.silnik.Tankuj();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement