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 ConsoleApp1
- {
- class Program
- {
- static void nadajSpecyfikacje(Komputer komp1)
- {
- Console.Write("Podaj nazwe komputera: ");
- komp1.nazwa = Console.ReadLine();
- Console.Write("Podaj procesor komputera: ");
- komp1.procesor = Console.ReadLine();
- Console.Write("Podaj karte graficzną komputera: ");
- komp1.kartaGraficzna = Console.ReadLine();
- }
- static void pokazSpecyfikacje(Komputer komp1)
- {
- Console.Write("Nazwa komputera: "); Console.WriteLine(komp1.nazwa);
- Console.Write("Procesor: "); Console.WriteLine(komp1.procesor);
- Console.Write("Karta graficzna: "); Console.WriteLine(komp1.kartaGraficzna);
- }
- static void Main(string[] args)
- {
- int koniec = 0;
- do
- {
- Console.WriteLine("Witaj w menu głównym!");
- Console.WriteLine("[1] Nowy komputer");
- Console.WriteLine("[2] Pokaż specyfikacje");
- Console.WriteLine("[3] Wyjdź z programu");
- int warunek = int.Parse(Console.ReadLine());
- switch (warunek)
- {
- case 1:
- {
- Komputer komp1 = new Komputer();
- nadajSpecyfikacje(komp1);
- break;
- }
- case 2:
- {
- pokazSpecyfikacje(komp1);
- break;
- }
- case 3:
- {
- koniec = 1; // spelnony warunek wyjscia
- break;
- }
- default:
- {
- Console.WriteLine("Podano złą wartość");
- koniec = 1;
- break;
- }
- }
- } while (koniec != 1);
- }
- }
- class Komputer
- {
- public string nazwa;
- public string procesor;
- public string kartaGraficzna;
- public void startKomputera()
- {
- Console.WriteLine("Komputer jest uruchamiany");
- }
- public void wylaczanieKomputera()
- {
- Console.WriteLine("Komputer jest wyłączany");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement