Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
456 changes: 398 additions & 58 deletions AppsLab.CSharp.Exercises.sln

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions AutoBazar – kópia/Auto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace AutoBazar
{
internal class Auto
{

public string Auticka { get; set; }
public string Znacka { get; set; }
public string Model { get; set; }
public int Cena { get; set; }
public int Spotreba { get; set; }
public int Pasaziery { get; set; }
public int Batozina { get; set; }
public string Opis { get; set; }

public Auto(string auticka, string znacka, string model, int cena, int spotreba, int pasaziery, int batozina, string opis)
{
Auticka = auticka;
Znacka = znacka;
Model = model;
Cena = cena;
Spotreba = spotreba;
Pasaziery = pasaziery;
Batozina = batozina;
Opis = opis;
}

public virtual void VypisInfo()
{
Console.WriteLine($"Auto {Znacka} {Model} za {Cena}$ ma spotrebu {Spotreba} velkost batozinoveho priestoru je {Batozina} pasaziery {Pasaziery} Opis: {Opis}");
}
}
}
10 changes: 10 additions & 0 deletions AutoBazar – kópia/AutoBazar.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
34 changes: 34 additions & 0 deletions AutoBazar – kópia/Garaze.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoBazar
{
internal class Garaze
{
public List<Auto> ZoznamAut { get; set; }

public void Pozicovna()
{
ZoznamAut = new List<Auto>();
}

public void Pozicovna(List<Auto> zoznamAut)
{
ZoznamAut = zoznamAut;
}
public void PridajAuto(Auto auto)
{
ZoznamAut.Add(auto);
}
public void VypisVsetkyAuta()
{
foreach (var vozidlo in ZoznamAut)
{
vozidlo.VypisInfo();
}
}
}
}
31 changes: 31 additions & 0 deletions AutoBazar – kópia/Generator Aut.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoBazar
{
internal class Generator_Aut
{
private static string[] auticka = { "Toyota – Corolla", "Volkswagen – Golf", "Ford – Fiesta", "BMW – 3 Series",
"Audi – A6", "Mercedes-Benz – A-Class", "Škoda – Octavia","Peugeot – 208","Renault – Clio","Nissan – Micra", "Honda – Civic", "Opel – Astra", "Hyundai – i30",
"Kia – Ceed", "Mazda – Mazda3","Subaru – Impreza","Mitsubishi - Lancer EVO 9","Ferrari – 488 GTB","Lexus – LH600","Jaguar – XE" };
public static Auto GenerujObcana()
{
Random rnd = new Random();
int cisielko = rnd.Next(auticka.Length);

string znacka = auticka[cisielko];

int cena = rnd.Next(12000, 200000);


Auto obivatel = new Auto(znacka, cena) { };

return obivatel;

}

}
}
169 changes: 169 additions & 0 deletions AutoBazar – kópia/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
using static System.Formats.Asn1.AsnWriter;

namespace AutoBazar
{
internal class Program
{
static void Main(string[] args)
{
List<string> auticka = new List<string>();
bool isEnd = false;

while (!isEnd)
{
VypisInfo();
var akcia = Console.ReadLine();

switch (akcia)
{
case "1": // pridavanie Aut
Console.Clear();
Menu();
Console.WriteLine("Zadaj Prihlasovacie meno");
var zadavaniemena = Console.ReadLine();
Console.WriteLine(" ");
Console.WriteLine("Zadaj Heslo");
var zadaniehesla = Console.ReadLine();
Console.WriteLine(" ");

var meno = "Jan";
var men0 = "Jakub";
var heslo = "Heslo123";
var hesl0 = "HesloHeslo";


if (zadavaniemena == meno && zadaniehesla == heslo)
{
Console.Clear();
Menu();

}
else if (zadavaniemena == men0 && zadaniehesla == hesl0)
{
Console.Clear();
Menu();

}
else
{
Console.WriteLine("Nespravne meno alebo heslo");
break;
}
Console.WriteLine("Znacka Aut");
var znacka = Console.ReadLine();
Console.WriteLine("----------------------------------------- ");
Console.WriteLine("Model Auta");
var model = Console.ReadLine();
Console.WriteLine("----------------------------------------- ");
Console.WriteLine("Cena Auta");
var cena = Console.ReadLine();
Console.WriteLine("----------------------------------------- ");
Console.WriteLine("Spotreba Auta");
var spotreba = Console.ReadLine();
Console.WriteLine("----------------------------------------- ");
Console.WriteLine("Pocet pasazierov");
var pasaziery = Console.ReadLine();
Console.WriteLine("----------------------------------------- ");
Console.WriteLine("Objem botozinoveho prietoru Auta");
var batozina = Console.ReadLine();
Console.WriteLine("----------------------------------------- ");
Console.WriteLine("Opis");
var opis = Console.ReadLine();
Console.WriteLine("----------------------------------------- ");

AddCar(auticka, znacka, model, Int32.Parse(cena), float.Parse(spotreba) , Int32.Parse(pasaziery), Int32.Parse(batozina), opis);
break;

case "2": // Prezeranie Aut

Console.Clear();
Menu();
foreach (var caros in auticka)
{
Console.WriteLine(caros);
Console.WriteLine("----------------------------------------- ");

}
Thread.Sleep(1000);

break;
case "3": //Oblubene Auta
Console.Clear();
Menu();
Console.WriteLine("Eror 404 Akcia neplatna");

break;
case "4": //Kupovanie Auta
Console.Clear();
Menu();
Console.WriteLine("Eror 404 Akcia neplatna");

break;

case "5": //Harakiri aplikacie
isEnd = true;
Console.WriteLine("");
Console.WriteLine("Dakujeme za pouzivanie applikacie. Dufam za sa vratite");
break;

}
}
}

public static void AddCar(List<string> carList, string znacka1, string model1, int cena1, double spotreba1,int batozina1, int pasaziery1, string opis1)
{
string foundedCar = null;
foreach (var car in carList)
{
if (car.Contains(znacka1))
{
foundedCar = car;

}
}

if (foundedCar == null)
{
var newCreatedCar = $"Auto {znacka1} {model1} za {cena1}$ ma spotrebu {spotreba1} velkost batozinoveho priestoru je {batozina1} pasaziery {pasaziery1} Opis: {opis1}";
carList.Add(newCreatedCar);
Console.WriteLine($"Auto: {znacka1.ToUpper()} bolo pridane do aplikacie.");
}
}
public static void VypisInfo()
{
Thread.Sleep(1500);
Console.Clear();
Console.WriteLine(" ___ __ ____");
Console.WriteLine(" / | __ __/ /______ / __ )____ _____ ____ ______");
Console.WriteLine(" / /| |/ / / / __/ __ |/ __ / __ /_ / __ / ___/");
Console.WriteLine(" / ___ / /_/ / /_/ /_/ / /_/ / /_/ / / /_/_/ / /");
Console.WriteLine("/_/ |_|__._/|__/|___/_____/ |__,_/ /___/|__/_/");
Console.WriteLine("------------------------------------------------------- ");
Console.WriteLine(" | _. ._ _. | _. | |_ ");
Console.WriteLine("\\_| (_| | | (_| \\_| (_| |< |_| |_) ");
Console.WriteLine("----------------------------------------- ");
Console.WriteLine("1. Pridanie Auta");
Console.WriteLine("2. Prezeranie Aut");
Console.WriteLine("3. Oblubene Auta");
Console.WriteLine("4. Kupovanie Auta");
Console.WriteLine("5. Exit");
Console.WriteLine(" ");
Console.WriteLine("Vyberte akciu ");
}
public static void Menu()
{
Console.WriteLine(" ___ __ ____");
Console.WriteLine(" / | __ __/ /______ / __ )____ _____ ____ ______");
Console.WriteLine(" / /| |/ / / / __/ __ |/ __ / __ /_ / __ / ___/");
Console.WriteLine(" / ___ / /_/ / /_/ /_/ / /_/ / /_/ / / /_/_/ / /");
Console.WriteLine("/_/ |_|__._/|__/|___/_____/ |__,_/ /___/|__/_/");
Console.WriteLine("------------------------------------------------------- ");
Console.WriteLine(" | _. ._ _. | _. | |_ ");
Console.WriteLine("\\_| (_| | | (_| \\_| (_| |< |_| |_) ");
Console.WriteLine("----------------------------------------- ");
}


}

}
39 changes: 39 additions & 0 deletions AutoBazar/Auto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace AutoBazar
{
internal class Auto
{
public int ID { get; set; }
public string Znacka { get; set; }
public string Model { get; set; }
public int Cena { get; set; }
public int Spotreba { get; set; }
public int Pasaziery { get; set; }
public int Batozina { get; set; }
public string Opis { get; set; }

public Auto(int id,string znacka, string model, int cena, int spotreba, int pasaziery, int batozina, string opis)
{
this.ID = id;
Znacka = znacka;
Model = model;
Cena = cena;
Spotreba = spotreba;
Pasaziery = pasaziery;
Batozina = batozina;
Opis = opis;
}

public virtual void VypisInfo()
{
Console.WriteLine($"{ID} - {Znacka} {Model} za {Cena}$ ma spotrebu {Spotreba} velkost batozinoveho priestoru je {Batozina} pasaziery {Pasaziery} Opis: {Opis}");
Console.WriteLine("--------------------------------------------------------------------------------------------------------------------------------------------------");
}
}
}
10 changes: 10 additions & 0 deletions AutoBazar/AutoBazar.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Loading