Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class marka
- {
- string nazwa;
- public string nazwamarki() { return nazwa; }
- public marka(string mrk)
- {
- nazwa = mrk;
- }
- }
- class samochod : marka{
- string mark;
- string model;
- string typ;
- string vmax;
- string zerosto;
- int ilosc;
- int cena;
- public samochod(string mrk, string mdl, string tp, string vm, string zs, int il, int cen) : base (mrk)
- {
- mark = mrk;
- model = mdl;
- typ = tp;
- vmax = vm;
- zerosto = zs;
- ilosc = il;
- cena = cen;
- }
- public void wyswietlsamochod()
- {
- Console.Clear();
- Console.WriteLine("-------------------------------------------------");
- Console.WriteLine("{0} | {1} | {2} | {3}| {4} | {5} | {6} |", mark, model, typ, vmax, zerosto, ilosc, cena);
- Console.WriteLine("-------------------------------------------------");
- }
- }
- class input
- {
- public input() {}
- public string getFromInput()
- {
- string input;
- Console.Write(">:");
- input = Console.ReadLine();
- return input;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- string [] danepojazdu = new string[7];
- input imp = new input();
- Console.WriteLine("Podaj markę pojazdu:");
- string marka = imp.getFromInput();
- marka m = new marka(marka);
- danepojazdu[0] = marka;
- Console.WriteLine("wprowadź następujące dane: model, typ, vmax, 0-100, ilosc, cena; zatwierdzajac naciakając enter:");
- for (int i = 1; i < danepojazdu.Length; i++)
- {
- danepojazdu[i] = imp.getFromInput();
- }
- samochod s = new samochod(m.nazwamarki(), danepojazdu[1], danepojazdu[2], danepojazdu[3], danepojazdu[4], Int32.Parse(danepojazdu[5]), Int32.Parse(danepojazdu[6]));
- Console.Clear();
- Console.WriteLine("Prosze wybrac opcje: \n ->wyswirtl marki \n ->wyswietl samochody");
- string sw = imp.getFromInput();
- // switch (sw)
- // {
- // case
- // }
- s.wyswietlsamochod();
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement