From ea6dc65865680b14086b4e26b503e0d9b293a372 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Tue, 26 Oct 2021 00:04:06 +0300 Subject: [PATCH 1/8] feat: initial commit --- .gitignore | 388 ++++++++++++++++++ Lab2.Exercises.Register/Dog.cs | 63 +++ Lab2.Exercises.Register/Dogs.csv | 8 + Lab2.Exercises.Register/DogsRegister.cs | 126 ++++++ Lab2.Exercises.Register/Gender.cs | 12 + Lab2.Exercises.Register/InOutUtils.cs | 96 +++++ .../Lab2.Exercises.Register.csproj | 17 + Lab2.Exercises.Register/Program.cs | 69 ++++ Lab2.Exercises.Register/TaskUtils.cs | 99 +++++ Lab2.Exercises.Register/Vaccination.cs | 26 ++ Lab2.Exercises.Register/Vaccinations.csv | 6 + Lab2.Exercises.sln | 37 ++ Lab2.TouristInformationCenter/InOutUtils.cs | 226 ++++++++++ .../Lab2.TouristInformationCenter.csproj | 20 + Lab2.TouristInformationCenter/Museum.cs | 28 ++ .../MuseumsKaunas.csv | 8 + .../MuseumsRegister.cs | 235 +++++++++++ .../MuseumsVilnius.csv | 7 + Lab2.TouristInformationCenter/Program.cs | 33 ++ Lab2.TouristInformationCenter/Weekday.cs | 17 + README.md | 6 + Savarankiskas/Apartment.cs | 28 ++ Savarankiskas/Apartments.csv | 6 + Savarankiskas/ApartmentsRegister.cs | 92 +++++ Savarankiskas/InOutUtils.cs | 43 ++ Savarankiskas/Program.cs | 34 ++ Savarankiskas/Savarankiskas.csproj | 14 + 27 files changed, 1744 insertions(+) create mode 100644 .gitignore create mode 100644 Lab2.Exercises.Register/Dog.cs create mode 100644 Lab2.Exercises.Register/Dogs.csv create mode 100644 Lab2.Exercises.Register/DogsRegister.cs create mode 100644 Lab2.Exercises.Register/Gender.cs create mode 100644 Lab2.Exercises.Register/InOutUtils.cs create mode 100644 Lab2.Exercises.Register/Lab2.Exercises.Register.csproj create mode 100644 Lab2.Exercises.Register/Program.cs create mode 100644 Lab2.Exercises.Register/TaskUtils.cs create mode 100644 Lab2.Exercises.Register/Vaccination.cs create mode 100644 Lab2.Exercises.Register/Vaccinations.csv create mode 100644 Lab2.Exercises.sln create mode 100644 Lab2.TouristInformationCenter/InOutUtils.cs create mode 100644 Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj create mode 100644 Lab2.TouristInformationCenter/Museum.cs create mode 100644 Lab2.TouristInformationCenter/MuseumsKaunas.csv create mode 100644 Lab2.TouristInformationCenter/MuseumsRegister.cs create mode 100644 Lab2.TouristInformationCenter/MuseumsVilnius.csv create mode 100644 Lab2.TouristInformationCenter/Program.cs create mode 100644 Lab2.TouristInformationCenter/Weekday.cs create mode 100644 README.md create mode 100644 Savarankiskas/Apartment.cs create mode 100644 Savarankiskas/Apartments.csv create mode 100644 Savarankiskas/ApartmentsRegister.cs create mode 100644 Savarankiskas/InOutUtils.cs create mode 100644 Savarankiskas/Program.cs create mode 100644 Savarankiskas/Savarankiskas.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..26ab8f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,388 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +.idea/ +*.sln.iml diff --git a/Lab2.Exercises.Register/Dog.cs b/Lab2.Exercises.Register/Dog.cs new file mode 100644 index 0000000..772a272 --- /dev/null +++ b/Lab2.Exercises.Register/Dog.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Lab2.Exercises.Register +{ + class Dog + { + public int ID { get; set; } + public string Name { get; set; } + public string Breed { get; set; } + public DateTime BirthDate { get; set; } + public Gender Gender { get; set; } + public DateTime LastVaccinationDate { get; set; } + + private const int VaccinationDuration = 1; + + public int Age + { + get + { + DateTime today = DateTime.Today; + int age = today.Year - this.BirthDate.Year; + if (BirthDate.Date > today.AddYears(-age)) + { + age--; + } + return age; + } + } + + public bool RequiresVaccination + { + get + { + if (LastVaccinationDate.Equals(DateTime.MinValue)) + { + return true; + } + return LastVaccinationDate.AddYears(VaccinationDuration).CompareTo(DateTime.Now) < 0; + } + } + + + public Dog(int id, string name, string breed, DateTime birthDate, Gender gender) + { + ID = id; + Name = name; + Breed = breed; + BirthDate = birthDate; + Gender = gender; + } + + public override bool Equals(object other) + { + return ID == ((Dog)other).ID; + } + public override int GetHashCode() + { + return ID.GetHashCode(); + } + } +} diff --git a/Lab2.Exercises.Register/Dogs.csv b/Lab2.Exercises.Register/Dogs.csv new file mode 100644 index 0000000..731dbf3 --- /dev/null +++ b/Lab2.Exercises.Register/Dogs.csv @@ -0,0 +1,8 @@ +123;Reksas;Buldogas;2014-01-01;Male +124;Margis;Dalmantinas;2014-02-28;Male +125;Bitė;Senbernaras;2008-07-17;Female +320;Rikis;Taksas;2012-01-07;Male +123;Reksas;Buldogas;2014-01-01;Male +415;Pifas;Taksas;2014-07-07;Male +420;Markas;Dalmantinas;2013-02-28;Female +123;Reksas;Buldogas;2014-01-01;Male \ No newline at end of file diff --git a/Lab2.Exercises.Register/DogsRegister.cs b/Lab2.Exercises.Register/DogsRegister.cs new file mode 100644 index 0000000..57754fd --- /dev/null +++ b/Lab2.Exercises.Register/DogsRegister.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Lab2.Exercises.Register +{ + class DogsRegister + { + private List AllDogs; + public DogsRegister() + { + AllDogs = new List(); + } + public DogsRegister(List Dogs) + { + AllDogs = new List(); + foreach (Dog dog in Dogs) + { + this.AllDogs.Add(dog); + } + } + public void Add(Dog dog) + { + AllDogs.Add(dog); + } + + public int DogsCount() + { + return AllDogs.Count; + } + + public Dog GetByIndex(int index) + { + return AllDogs[index]; + } + + public int CountByGender(Gender gender) + { + int count = 0; + foreach (Dog dog in AllDogs) + { + if (dog.Gender.Equals(gender)) + { + count++; + } + } + return count; + } + + public Dog FindOldestDog() + { + return this.FindOldestDog(this.AllDogs); + } + + public List FilterByBreed(string breed) + { + List Filtered = new List(); + foreach (Dog dog in AllDogs) + { + if (dog.Breed.Equals(breed)) // uses string method Equals() + { + Filtered.Add(dog); + } + } + return Filtered; + } + + public Dog FindOldestDog(string breed) + { + List Filtered = this.FilterByBreed(breed); + return this.FindOldestDog(Filtered); + } + private Dog FindOldestDog(List Dogs) + { + Dog oldest = Dogs[0]; + for (int i = 1; i < Dogs.Count; i++) //starts on index value 1 + { + if (DateTime.Compare(oldest.BirthDate, Dogs[i].BirthDate) > 0) + { + oldest = Dogs[i]; + } + } + return oldest; + } + private Dog FindDogByID(int ID) + { + foreach (Dog dog in AllDogs) + { + if (dog.ID == ID) + { + return dog; + } + } + return null; + + } + public void UpdateVaccinationsInfo(List Vaccinations) + { + foreach (Vaccination vaccination in Vaccinations) + { + Dog dog = FindDogByID(vaccination.DogID); + if (dog != null && vaccination > dog.LastVaccinationDate) + { + dog.LastVaccinationDate = vaccination.Date; + } + } + } + + public List FilterByVaccinationExpired() + { + List Filtered = new List(); + foreach (Dog dog in AllDogs) + { + if (dog.RequiresVaccination) + { + Filtered.Add(dog); + } + } + return Filtered; + } + public bool Contains(Dog dog) + { + return AllDogs.Contains(dog); + } + } +} diff --git a/Lab2.Exercises.Register/Gender.cs b/Lab2.Exercises.Register/Gender.cs new file mode 100644 index 0000000..016e3ff --- /dev/null +++ b/Lab2.Exercises.Register/Gender.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Lab2.Exercises.Register +{ + enum Gender + { + Male = 1, + Female = 2, + } +} diff --git a/Lab2.Exercises.Register/InOutUtils.cs b/Lab2.Exercises.Register/InOutUtils.cs new file mode 100644 index 0000000..e2dacce --- /dev/null +++ b/Lab2.Exercises.Register/InOutUtils.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace Lab2.Exercises.Register +{ + class InOutUtils + { + + public static List ReadVaccinations(string fileName) + { + List Vaccinations = new List(); + string[] Lines = File.ReadAllLines(fileName); + foreach (string line in Lines) + { + string[] values = line.Split(';'); + int id = int.Parse(values[0]); + DateTime vaccinationDate = DateTime.Parse(values[1]); + Vaccination v = new Vaccination(id, vaccinationDate); + Vaccinations.Add(v); + } + return Vaccinations; + } + + public static DogsRegister ReadDogs(string fileName) + { + DogsRegister Dogs = new DogsRegister(); + string[] Lines = File.ReadAllLines(fileName, Encoding.UTF8); + foreach (string line in Lines) + { + string[] values = line.Split(';'); + int id = int.Parse(values[0]); + string name = values[1]; + string breed = values[2]; + DateTime birthDate = DateTime.Parse(values[3]); + Gender gender; + Enum.TryParse(values[4], out gender); //tries to convert value to enum + Dog dog = new Dog(id, name, breed, birthDate, gender); + if (!Dogs.Contains(dog)) + { + Dogs.Add(dog); + } + } + return Dogs; + } + public static void PrintDogs(DogsRegister register) + { + Console.WriteLine(new string('-', 74)); + Console.WriteLine("| {0,8} | {1,-15} | {2,-15} | {3,-12} | {4,-8} |", "Reg.Nr.", "Vardas", "Veislė", "Gimimo data", "Lytis"); + Console.WriteLine(new string('-', 74)); + for (int i = 0; i < register.DogsCount(); i++) + { + Dog dog = register.GetByIndex(i); + Console.WriteLine("| {0,8} | {1,-15} | {2,-15} | {3,-12:yyyy-MM-dd} | {4,-8} |", dog.ID, dog.Name, dog.Breed, dog.BirthDate, dog.Gender); + } + Console.WriteLine(new string('-', 74)); + } + + public static void PrintDogs(List dogs) + { + Console.WriteLine(new string('-', 74)); + Console.WriteLine("| {0,8} | {1,-15} | {2,-15} | {3,-12} | {4,-8} |", "Reg.Nr.", "Vardas", "Veislė", "Gimimo data", "Lytis"); + Console.WriteLine(new string('-', 74)); + foreach (Dog dog in dogs) + { + Console.WriteLine("| {0,8} | {1,-15} | {2,-15} | {3,-12:yyyy-MM-dd} | {4,-8} |", dog.ID, dog.Name, dog.Breed, dog.BirthDate, dog.Gender); + } + Console.WriteLine(new string('-', 74)); + } + + public static void PrintDog(Dog dog) + { + Console.WriteLine("Vardas: {0}, Veislė: {1}, Amžius: {2}", dog.Name, dog.Breed, dog.Age); + } + + public static void PrintBreeds(List breeds) + { + foreach (string breed in breeds) + { + Console.WriteLine(breed); + } + } + + public static void PrintDogsToCSVFile(string fileName, List Dogs) + { + string[] lines = new string[Dogs.Count + 1]; + lines[0] = String.Format("{0};{1};{2};{3};{4}", "Reg.Nr.", "Vardas", "Veislė", "Gimimo data", "Lytis"); + for (int i = 0; i < Dogs.Count; i++) + { + lines[i + 1] = String.Format("{0};{1};{2};{3};{4}", Dogs[i].ID, Dogs[i].Name, Dogs[i].Breed, Dogs[i].BirthDate, Dogs[i].Gender); + } + File.WriteAllLines(fileName, lines, Encoding.UTF8); + } + } +} diff --git a/Lab2.Exercises.Register/Lab2.Exercises.Register.csproj b/Lab2.Exercises.Register/Lab2.Exercises.Register.csproj new file mode 100644 index 0000000..84ebe8a --- /dev/null +++ b/Lab2.Exercises.Register/Lab2.Exercises.Register.csproj @@ -0,0 +1,17 @@ + + + + Exe + netcoreapp2.1 + + + + + PreserveNewest + + + PreserveNewest + + + + diff --git a/Lab2.Exercises.Register/Program.cs b/Lab2.Exercises.Register/Program.cs new file mode 100644 index 0000000..24f15d1 --- /dev/null +++ b/Lab2.Exercises.Register/Program.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; + +namespace Lab2.Exercises.Register +{ + class Program + { + static void Main(string[] args) + { + DogsRegister register = InOutUtils.ReadDogs("Dogs.csv"); + Console.WriteLine("Registro informacija:"); + InOutUtils.PrintDogs(register); + Console.WriteLine(); + + + Console.WriteLine("Iš viso šunų: {0}", register.DogsCount()); + Console.WriteLine("Patinų: {0}", register.CountByGender(Gender.Male)); + Console.WriteLine("Patelių: {0}", register.CountByGender(Gender.Female)); + Console.WriteLine(); + + List VaccinationsData = InOutUtils.ReadVaccinations(@"Vaccinations.csv"); + register.UpdateVaccinationsInfo(VaccinationsData); + + Console.WriteLine("Šunys kuriems reikia vakcinuotis:"); + InOutUtils.PrintDogs(register.FilterByVaccinationExpired()); + + + /* + Dog oldestDog = TaskUtils.FindOldestDog(register); + Console.WriteLine("Seniausias šuo:"); + InOutUtils.PrintDog(oldestDog); + Console.WriteLine(); + + List breeds = TaskUtils.FindBreeds(register); + Console.WriteLine("Šunų veislės:"); + InOutUtils.PrintBreeds(breeds); + Console.WriteLine(); + + List popularBreeds = TaskUtils.FindMostPopularBreeds(register); + Console.WriteLine("Populiariausios šunų veislės:"); + InOutUtils.PrintBreeds(popularBreeds); + Console.WriteLine(); + + Console.WriteLine("Kokios veislės šunis atrinkti?"); + string selectedBreed = Console.ReadLine().Trim(); + if (selectedBreed.Equals("")) + { + Console.WriteLine("Šunio veislė neįvesta"); + return; + } + + List filteredByBreed = TaskUtils.FilterByBreed(register, selectedBreed); + if (filteredByBreed.Count == 0) + { + Console.WriteLine("Šunų su veisle '{0}' nerasta", selectedBreed); + return; + } + + Dog oldestFilteredDog = TaskUtils.FindOldestDog(filteredByBreed); + Console.WriteLine("Seniausias šuo pagal '{0}' veislę:", selectedBreed); + InOutUtils.PrintDog(oldestFilteredDog); + InOutUtils.PrintDogs(filteredByBreed); + string fileName = selectedBreed + ".csv"; + InOutUtils.PrintDogsToCSVFile(fileName, filteredByBreed); + */ + + } + } +} diff --git a/Lab2.Exercises.Register/TaskUtils.cs b/Lab2.Exercises.Register/TaskUtils.cs new file mode 100644 index 0000000..057b860 --- /dev/null +++ b/Lab2.Exercises.Register/TaskUtils.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Lab2.Exercises.Register +{ + class TaskUtils + { + public static int CountByGender(List dogs, Gender gender) + { + int count = 0; + foreach (Dog dog in dogs) + { + if (dog.Gender.Equals(gender)) + { + count++; + } + } + return count; + } + public static Dog FindOldestDog(List dogs) + { + Dog oldest = dogs[0]; // means least value + for (int i = 1; i < dogs.Count; i++) + { + if (DateTime.Compare(dogs[i].BirthDate, oldest.BirthDate) < 0) + { + oldest = dogs[i]; + } + } + return oldest; + } + public static List FindBreeds(List dogs) + { + List Breeds = new List(); + foreach (Dog dog in dogs) + { + string breed = dog.Breed; + if (!Breeds.Contains(breed)) // uses List method Contains() + { + Breeds.Add(breed); + } + } + return Breeds; + } + + public static List FilterByBreed(List dogs, string breed) + { + List Filtered = new List(); + foreach (Dog dog in dogs) + { + if (dog.Breed.Equals(breed)) // uses string method Equals() + { + Filtered.Add(dog); + } + } + return Filtered; + } + + public static int CountByBreed(List dogs, string breed) + { + int count = 0; + foreach (Dog dog in dogs) + { + if (dog.Breed.Equals(breed)) // uses string method Equals() + { + count++; + } + } + return count; + } + + public static List FindMostPopularBreeds(List dogs) + { + List breeds = FindBreeds(dogs); + int mostPopularCount = CountByBreed(dogs, breeds[0]); + foreach (string breed in breeds) + { + int count = CountByBreed(dogs, breed); + if (count > mostPopularCount) + { + mostPopularCount = count; + } + } + + List popularBreeds = new List(); + foreach (string breed in breeds) + { + if (CountByBreed(dogs, breed) == mostPopularCount) + { + popularBreeds.Add(breed); + } + } + + return popularBreeds; + } + + } +} diff --git a/Lab2.Exercises.Register/Vaccination.cs b/Lab2.Exercises.Register/Vaccination.cs new file mode 100644 index 0000000..14bb7f2 --- /dev/null +++ b/Lab2.Exercises.Register/Vaccination.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Lab2.Exercises.Register +{ + class Vaccination + { + public int DogID { get; set; } + public DateTime Date { get; set; } + public Vaccination(int dogID, DateTime date) + { + DogID = dogID; + Date = date; + } + public static bool operator <(Vaccination vaccination, DateTime date) + { + return vaccination.Date.CompareTo(date) < 0; + } + public static bool operator >(Vaccination vaccination, DateTime date) + { + return vaccination.Date.CompareTo(date) > 0; + } + + } +} diff --git a/Lab2.Exercises.Register/Vaccinations.csv b/Lab2.Exercises.Register/Vaccinations.csv new file mode 100644 index 0000000..48d2239 --- /dev/null +++ b/Lab2.Exercises.Register/Vaccinations.csv @@ -0,0 +1,6 @@ +123;2020-07-24 +124;2021-05-17 +421;2021-07-01 +125;2021-01-01 +320;2021-07-01 +320;2010-07-01 \ No newline at end of file diff --git a/Lab2.Exercises.sln b/Lab2.Exercises.sln new file mode 100644 index 0000000..2f06354 --- /dev/null +++ b/Lab2.Exercises.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1525 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lab2.Exercises.Register", "Lab2.Exercises.Register\Lab2.Exercises.Register.csproj", "{64F8D782-79CA-49D2-BA07-A53EE7F7F058}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Savarankiskas", "Savarankiskas\Savarankiskas.csproj", "{40CF34FD-C166-41D9-A728-CA4C9FFCBB4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab2.TouristInformationCenter", "Lab2.TouristInformationCenter\Lab2.TouristInformationCenter.csproj", "{CB6002C8-B1AA-46A4-A9B1-ABDE53344524}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64F8D782-79CA-49D2-BA07-A53EE7F7F058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64F8D782-79CA-49D2-BA07-A53EE7F7F058}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64F8D782-79CA-49D2-BA07-A53EE7F7F058}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64F8D782-79CA-49D2-BA07-A53EE7F7F058}.Release|Any CPU.Build.0 = Release|Any CPU + {40CF34FD-C166-41D9-A728-CA4C9FFCBB4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40CF34FD-C166-41D9-A728-CA4C9FFCBB4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40CF34FD-C166-41D9-A728-CA4C9FFCBB4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40CF34FD-C166-41D9-A728-CA4C9FFCBB4B}.Release|Any CPU.Build.0 = Release|Any CPU + {CB6002C8-B1AA-46A4-A9B1-ABDE53344524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB6002C8-B1AA-46A4-A9B1-ABDE53344524}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB6002C8-B1AA-46A4-A9B1-ABDE53344524}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB6002C8-B1AA-46A4-A9B1-ABDE53344524}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E9FC39F0-DE0D-41FC-94F6-DB6F5F607B72} + EndGlobalSection +EndGlobal diff --git a/Lab2.TouristInformationCenter/InOutUtils.cs b/Lab2.TouristInformationCenter/InOutUtils.cs new file mode 100644 index 0000000..1604e81 --- /dev/null +++ b/Lab2.TouristInformationCenter/InOutUtils.cs @@ -0,0 +1,226 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.IO.Compression; + +namespace Lab2.TouristInformationCenter +{ + /// + /// Class that stores functions that are related to reading and writing data + /// + class InOutUtils + { + /// + /// Append the museums from the second register to the first one + /// + /// First register + /// Second register + private static void AppendRegister(MuseumsRegister register1, MuseumsRegister register2) + { + for (int i = 0; i < register2.Count(); i++) + { + register1.Add(register2.GetByIndex(i)); + } + } + + /// + /// Decode a list of museums from a given list of lines. + /// + /// + /// Register of museums + public static MuseumsRegister DecodeMuseums(List lines) + { + List museums = new List(); + string city = lines[0]; + string manager = lines[1]; + for (int i = 2; i < lines.Count; i++) + { + string line = lines[i]; + string[] values = line.Split(';'); + string name = values[0]; + string type = values[1]; + List workdays = new List(); + if (int.Parse(values[2]) == 1) + { + workdays.Add(Weekday.Monday); + } + if (int.Parse(values[3]) == 1) + { + workdays.Add(Weekday.Tuesday); + } + if (int.Parse(values[4]) == 1) + { + workdays.Add(Weekday.Wednesday); + } + if (int.Parse(values[5]) == 1) + { + workdays.Add(Weekday.Thursday); + } + if (int.Parse(values[6]) == 1) + { + workdays.Add(Weekday.Friday); + } + if (int.Parse(values[7]) == 1) + { + workdays.Add(Weekday.Saturday); + } + if (int.Parse(values[8]) == 1) + { + workdays.Add(Weekday.Sunday); + } + double price = double.Parse(values[9]); + bool hasGuide = int.Parse(values[10]) == 1; + + Museum museum = new Museum(name, city, manager, type, workdays, price, hasGuide); + museums.Add(museum); + } + return new MuseumsRegister(museums); + } + + /// + /// Read and decode a list of museums from a file. + /// + /// Target file + /// Register of museums + public static MuseumsRegister ReadMuseumsFromCSV(string filename) + { + List lines = new List(); + foreach (string line in File.ReadAllLines(filename, Encoding.UTF8)) + { + lines.Add(line); + } + return DecodeMuseums(lines); + } + + /// + /// Read all the entries from a zip file and decode the museums inside the csv entries. + /// + /// Target filename + /// Register of museums + public static MuseumsRegister ReadMuseumsFromZIP(string filename) + { + MuseumsRegister mainRegister = new MuseumsRegister(); + + using (ZipArchive zipFile = ZipFile.Open(filename, ZipArchiveMode.Read)) + { + foreach (ZipArchiveEntry entry in zipFile.Entries) + { + if (!entry.Name.EndsWith(".csv")) continue; + List lines = new List(); + using (StreamReader reader = new StreamReader(entry.Open(), Encoding.UTF8)) + { + while (!reader.EndOfStream) + { + lines.Add(reader.ReadLine()); + } + } + + MuseumsRegister register = DecodeMuseums(lines); + AppendRegister(mainRegister, register); + } + + } + + return mainRegister; + } + + /// + /// Read and decode lists of museums from multiple files and put into a single register. + /// + /// Target files + /// Register containing museums from all files + public static MuseumsRegister ReadMuseums(params string[] filenames) + { + MuseumsRegister mainRegister = new MuseumsRegister(l); + foreach (string filename in filenames) + { + if (filename.EndsWith(".csv")) + { + AppendRegister(mainRegister, ReadMuseumsFromCSV(filename)); + } + else if(filename.EndsWith(".zip")) + { + AppendRegister(mainRegister, ReadMuseumsFromZIP(filename)); + } + } + return mainRegister; + } + + /// + /// Write and encode a list of museums to a file. The file will be in a csv format using ";" as seperators. + /// + /// Target file + /// List of museums + public static void WriteMuseums(string filename, List museums) + { + string[] lines = new string[museums.Count]; + for (int i = 0; i < museums.Count; i++) + { + Museum m = museums[i]; + string workDays = ""; + workDays += m.Workdays.Contains(Weekday.Monday) ? "1" : "0"; + workDays += m.Workdays.Contains(Weekday.Tuesday) ? ";1" : ";0"; + workDays += m.Workdays.Contains(Weekday.Wednesday) ? ";1" : ";0"; + workDays += m.Workdays.Contains(Weekday.Thursday) ? ";1" : ";0"; + workDays += m.Workdays.Contains(Weekday.Friday) ? ";1" : ";0"; + workDays += m.Workdays.Contains(Weekday.Saturday) ? ";1" : ";0"; + workDays += m.Workdays.Contains(Weekday.Sunday) ? ";1" : ";0"; + + lines[i] = String.Join(";", m.City, m.Name, workDays, m.Price); + } + File.WriteAllLines(filename, lines, Encoding.UTF8); + } + + /// + /// Write and encode a list of museums to a file from a register. + /// + /// Target location + /// Register containing museums + public static void WriteMuseums(string filename, MuseumsRegister register) + { + List museums = new List(); + for (int i = 0; i < register.Count(); i++) + { + museums.Add(register.GetByIndex(i)); + } + WriteMuseums(filename, museums); + } + + /// + /// Write out a list of museums in a table to the console. + /// + /// List of museums + public static void PrintMuseums(List museums) + { + if (museums.Count == 0) + { + Console.WriteLine("Nėra"); + return; + } + + Console.WriteLine(new string('-', 115)); + Console.WriteLine("| {0,20} | {1,-10} | {2,20} | {3,-10} | {4,-18} | {5,-3} | {6,-4} |", "Vardas", "Miestas", "Atsakingas", "Tipas", "Darbo dienų kiekis", "Kaina", "Turi gidą?"); + Console.WriteLine(new string('-', 115)); + foreach (Museum m in museums) + { + Console.WriteLine("| {0,20} | {1,-10} | {2, 20} | {3,-10} | {4,-18} | {5,-5:f2} | {6,-10} |", m.Name, m.City, m.Manager, m.Type, m.Workdays.Count, m.Price, m.HasGuide ? "Taip" : "Ne"); + } + Console.WriteLine(new string('-', 115)); + } + + /// + /// Write out a list of museums in a table to the console from a register. + /// + /// Register containing museums + public static void PrintMuseums(MuseumsRegister register) + { + List museums = new List(); + for (int i = 0; i < register.Count(); i++) + { + museums.Add(register.GetByIndex(i)); + } + PrintMuseums(museums); + } + } +} diff --git a/Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj b/Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj new file mode 100644 index 0000000..443bf0e --- /dev/null +++ b/Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj @@ -0,0 +1,20 @@ + + + + Exe + netcoreapp2.1 + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + diff --git a/Lab2.TouristInformationCenter/Museum.cs b/Lab2.TouristInformationCenter/Museum.cs new file mode 100644 index 0000000..41d64ea --- /dev/null +++ b/Lab2.TouristInformationCenter/Museum.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Lab2.TouristInformationCenter +{ + /// + /// Class used for storing data related a single museum. + /// + class Museum + { + public string Name { get; set; } + public string City { get; set; } + public string Manager { get; set; } + public string Type { get; set; } + public List Workdays { get; set; } + public double Price { get; set; } + public bool HasGuide { get; set; } + public Museum(string name, string city, string manager, string type, List workdays, double price, bool hasGuide) + { + Name = name; + Manager = manager; + City = city; + Type = type; + Workdays = workdays; + Price = price; + HasGuide = hasGuide; + } + } +} diff --git a/Lab2.TouristInformationCenter/MuseumsKaunas.csv b/Lab2.TouristInformationCenter/MuseumsKaunas.csv new file mode 100644 index 0000000..33ea67e --- /dev/null +++ b/Lab2.TouristInformationCenter/MuseumsKaunas.csv @@ -0,0 +1,8 @@ +Kaunas +Jonas Jonaitis +KaunoMuziejus1;Dailė;1;0;0;0;1;0;1;3,40;0 +KaunoMuziejus2;Computer;1;1;0;1;1;1;1;14,39;1 +KaunoMuziejus3;History;0;1;0;0;1;0;0;3,26;0 +KaunoMuziejus4;Dailė;0;1;0;1;1;0;1;9,47;1 +KaunoMuziejus5;Space;1;1;0;0;0;0;1;1,99;1 +KaunoMuziejus6;Space;1;1;1;1;1;1;1;0,99;1 \ No newline at end of file diff --git a/Lab2.TouristInformationCenter/MuseumsRegister.cs b/Lab2.TouristInformationCenter/MuseumsRegister.cs new file mode 100644 index 0000000..b04a3b5 --- /dev/null +++ b/Lab2.TouristInformationCenter/MuseumsRegister.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Lab2.TouristInformationCenter +{ + /// + /// Class used to store multiple museums in one place + /// + class MuseumsRegister + { + private List AllMuseums; + + public int size = 100; + + public MuseumsRegister() + { + AllMuseums = new List(); + } + + public MuseumsRegister(List museums) + { + AllMuseums = new List(); + foreach (Museum museum in museums) + { + Add(museum); + } + } + + /// + /// Add one museum to the register. + /// + /// Target museum + public void Add(Museum museum) + { + this.AllMuseums.Add(museum); + } + + /// + /// The amount of stored museums in the register. + /// + /// Museum count + public int Count() + { + return AllMuseums.Count; + } + + /// + /// Access museum from register by index + /// + /// Target index + /// Museum + public Museum GetByIndex(int index) + { + return AllMuseums[index]; + } + + /// + /// Return a list of active museums from the register. + /// A museum is considered active if it is working at least some amount a week. + /// + /// Threshold which determines what is active + /// A list of active museums + public List FilterByActiveMuseums(int threshold) + { + List filtered = new List(); + foreach (Museum museum in AllMuseums) + { + if (museum.Workdays.Count >= threshold) + { + filtered.Add(museum); + } + } + return filtered; + } + + /// + /// Find museum that work the most days in a week + /// + /// Most active museum + private static Museum FindMostActiveMuseum() + { + if (AllMuseums.Count == 0) + { + return null; + } + + Museum mostActive = AllMuseums[0]; + foreach (Museum museum in AllMuseums) + { + if (museum.Workdays.Count > mostActive.Workdays.Count) + { + mostActive = museum; + } + } + return mostActive; + } + + /// + /// Find all museums that work the most days in a week + /// + /// + public List FindMostActiveMuseums() + { + Museum mostActive = FindMostActiveMuseum(); + List activeMuseums = new List(); + foreach (Museum museum in AllMuseums) + { + if (museum.Workdays.Count == mostActive.Workdays.Count) + { + activeMuseums.Add(museum); + } + } + return activeMuseums; + } + + /// + /// Get all of the different types of cities. + /// + /// A list of city names + public List GetAllCities() + { + List cities = new List(); + foreach (Museum museum in AllMuseums) + { + if (!cities.Contains(museum.City)) + { + cities.Add(museum.City); + } + } + return cities; + } + + /// + /// Get the number of museums that a certain city has. + /// + /// Target city + /// Museum count by target city + public int GetCountByCity(string city) + { + int count = 0; + foreach (Museum museum in AllMuseums) + { + if (museum.City == city) + { + count++; + } + } + return count; + } + + /// + /// Filter the museums by city name from register + /// + /// Target city + /// A list of museums + public List FilterByCity(string city) + { + List filtered = new List(); + foreach (Museum museum in AllMuseums) + { + if (museum.City == city) + { + filtered.Add(museum); + } + } + return filtered; + } + + /// + /// Count the number of museums that have a guide from given list + /// + /// A list of museums + /// Museum count that have guides + public static int CountByGuide(List museums) + { + int count = 0; + foreach (Museum museum in museums) + { + if (museum.HasGuide) + { + count++; + } + } + return count; + } + + /// + /// Find city which has the most guides from the register + /// + /// City with the most guides + public string FindCityWithMostGuides() + { + List cities = GetAllCities(); + if (cities.Count == 0) + { + return null; + } + + string mostPopular = cities[0]; + int mostPopularCount = CountByGuide(FilterByCity(cities[0])); + for (int i = 1; i < cities.Count; i++) + { + string city = cities[i]; + int count = CountByGuide(FilterByCity(city)); + if (count > mostPopularCount) + { + mostPopular = city; + mostPopularCount = count; + } + } + + return mostPopular; + } + + /// + /// Filter given museums by property "Type". + /// + /// List of museums + /// Target type + /// A filtered list of museums + public static List FilterByType(List museums, string type) + { + List filtered = new List(); + foreach (Museum museum in museums) + { + if (museum.Type == type) + { + filtered.Add(museum); + } + } + return filtered; + } + } +} diff --git a/Lab2.TouristInformationCenter/MuseumsVilnius.csv b/Lab2.TouristInformationCenter/MuseumsVilnius.csv new file mode 100644 index 0000000..1ad3c88 --- /dev/null +++ b/Lab2.TouristInformationCenter/MuseumsVilnius.csv @@ -0,0 +1,7 @@ +Vilnius +Petras Petraitis +VilnausMuziejus1;Dailė;1;0;0;1;1;0;0;5,49;0 +VilnausMuziejus2;Computer;1;1;0;1;1;1;1;4,69;1 +VilnausMuziejus3;Dailė;0;1;1;1;1;0;0;1,23;0 +VilnausMuziejus4;Food;1;1;1;1;1;1;0;6,90;0 +VilnausMuziejus5;History;0;1;0;1;1;0;1;10,49;0 \ No newline at end of file diff --git a/Lab2.TouristInformationCenter/Program.cs b/Lab2.TouristInformationCenter/Program.cs new file mode 100644 index 0000000..19cf14c --- /dev/null +++ b/Lab2.TouristInformationCenter/Program.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +namespace Lab2.TouristInformationCenter +{ + class Program + { + static void Main(string[] args) + { + // Read all museums from initial data files + MuseumsRegister register = InOutUtils.ReadMuseums("MuseumsKaunas.csv", "MuseumsVilnius.csv"); + Console.WriteLine("Visi muziejai:"); + InOutUtils.PrintMuseums(register); + Console.WriteLine(); + + // Find all museums that are the most active + List mostActiveMuseums = register.FindMostActiveMuseums(); + Console.WriteLine("Aktyviausi muziejai:"); + InOutUtils.PrintMuseums(mostActiveMuseums); + Console.WriteLine(); + + // Find city which has the most museums with guides + string mostPopularCityByGuides = register.FindCityWithMostGuides(); + Console.WriteLine("Miestas su daugiausia gidų: {0}", mostPopularCityByGuides); + Console.WriteLine(); + + // Find all art museums that are active + List activeMuseums = register.FilterByActiveMuseums(4); + List activeArtMuseums = MuseumsRegister.FilterByType(activeMuseums, "Dailė"); + InOutUtils.WriteMuseums("Dailė.csv", activeArtMuseums); + } + } +} diff --git a/Lab2.TouristInformationCenter/Weekday.cs b/Lab2.TouristInformationCenter/Weekday.cs new file mode 100644 index 0000000..a09049f --- /dev/null +++ b/Lab2.TouristInformationCenter/Weekday.cs @@ -0,0 +1,17 @@ + +namespace Lab2.TouristInformationCenter +{ + /// + /// Used for storing weekdays as numbers rather than strings + /// + enum Weekday + { + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6, + Sunday = 7 + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..a1c6b40 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Introduction example project + +This project is from the "Object oriented programming" course in KTU. + +It is not polished in any way, so don't expect anything from this. + diff --git a/Savarankiskas/Apartment.cs b/Savarankiskas/Apartment.cs new file mode 100644 index 0000000..cdba166 --- /dev/null +++ b/Savarankiskas/Apartment.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Savarankiskas +{ + /// + /// Class used to store revelant information about an apartment + /// + class Apartment + { + public int Id { get; set; } + public double Area { get; set; } + public int RoomCount { get; set; } + public double Price { get; set; } + public string Phone { get; set; } + public int House { get { return (Id - 1) / 27 + 1; } } + public int Floor { get { return (Id - 1) % 9 + 1; } } + public Apartment(int id, double area, int roomCount, double price, string phone) + { + Id = id; + Area = area; + RoomCount = roomCount; + Price = price; + Phone = phone; + } + } +} diff --git a/Savarankiskas/Apartments.csv b/Savarankiskas/Apartments.csv new file mode 100644 index 0000000..0707850 --- /dev/null +++ b/Savarankiskas/Apartments.csv @@ -0,0 +1,6 @@ +1;80;3;999,99;+37012345678 +34;180;2;1300,00;+37012445678 +100;280;4;1300,45;+37012445678 +69;40;2;600,99;+37012945678 +27;69;2;420,69;+37012345678 +28;420;1;0,99;+37092345678 \ No newline at end of file diff --git a/Savarankiskas/ApartmentsRegister.cs b/Savarankiskas/ApartmentsRegister.cs new file mode 100644 index 0000000..6385269 --- /dev/null +++ b/Savarankiskas/ApartmentsRegister.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Savarankiskas +{ + class ApartmentsRegister + { + private List AllApartments; + public ApartmentsRegister() + { + AllApartments = new List(); + } + public ApartmentsRegister(List apartments) + { + AllApartments = new List(); + foreach (Apartment apartment in apartments) + { + Add(apartment); + } + } + + public void Add(Apartment apartment) + { + AllApartments.Add(apartment); + } + + public int Count() + { + return AllApartments.Count; + } + + public Apartment GetApartment(int index) + { + return AllApartments[index]; + } + + public static List FilterByRoomCount(List apartments, int roomCount) + { + List Filtered = new List(); + foreach (Apartment apartment in apartments) + { + if (apartment.RoomCount == roomCount) + { + Filtered.Add(apartment); + } + } + return Filtered; + } + + public List FilterByRoomCount(int roomCount) + { + return FilterByRoomCount(AllApartments, roomCount); + } + + public static List FilterByPrice(List apartments, double maxPrice) + { + List Filtered = new List(); + foreach (Apartment apartment in apartments) + { + if (apartment.Price <= maxPrice) + { + Filtered.Add(apartment); + } + } + return Filtered; + } + + public List FilterByPrice(double maxPrice) + { + return FilterByPrice(AllApartments, maxPrice); + } + + public static List FilterByFloor(List apartments, int minFloor, int maxFloor) + { + List Filtered = new List(); + foreach (Apartment apartment in apartments) + { + if (apartment.Floor >= minFloor && apartment.Floor <= maxFloor) + { + Filtered.Add(apartment); + } + } + return Filtered; + } + + public List FilterByFloor(int minFloor, int maxFloor) + { + return FilterByFloor(AllApartments, minFloor, maxFloor); + } + } +} diff --git a/Savarankiskas/InOutUtils.cs b/Savarankiskas/InOutUtils.cs new file mode 100644 index 0000000..31eca9b --- /dev/null +++ b/Savarankiskas/InOutUtils.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace Savarankiskas +{ + class InOutUtils + { + public static ApartmentsRegister ReadAparments(string filename) + { + List apartments = new List(); + string[] lines = File.ReadAllLines(filename, Encoding.UTF8); + foreach (string line in lines) + { + string[] values = line.Split(';'); + int id = int.Parse(values[0]); + double area = double.Parse(values[1]); + int roomCount = int.Parse(values[2]); + double price = double.Parse(values[3]); + string phone = values[4]; + Apartment apartment = new Apartment(id, area, roomCount, price, phone); + apartments.Add(apartment); + } + return new ApartmentsRegister(apartments); + } + + public static void PrintApartments(ApartmentsRegister register) + { + Console.WriteLine(new string('-', 78)); + Console.WriteLine("| {0,4} | {1,7} | {2,15} | {3,10} | {4,10} | {5,-13} |", "Num", "Aukštas", "Kambarių kiekis", "Plotas", "Kaina", "Telefonas"); + Console.WriteLine(new string('-', 78)); + for (int i = 0; i < register.Count(); i++) + { + Apartment aparment = register.GetApartment(i); + Console.WriteLine("| {0,4} | {1,7} | {2,15} | {3,10:f2} | {4,10:f2} | {5,-13} |", aparment.Id, aparment.Floor, aparment.RoomCount, aparment.Area, aparment.Price, aparment.Phone); + + } + Console.WriteLine(new string('-', 78)); + } + + } +} diff --git a/Savarankiskas/Program.cs b/Savarankiskas/Program.cs new file mode 100644 index 0000000..6bedbd6 --- /dev/null +++ b/Savarankiskas/Program.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; + +namespace Savarankiskas +{ + class Program + { + static void Main(string[] args) + { + ApartmentsRegister register = InOutUtils.ReadAparments("Apartments.csv"); + Console.WriteLine("Visi butai:"); + InOutUtils.PrintApartments(register); + Console.WriteLine(); + + Console.WriteLine("Įveskite norimą kambarių kiekį:"); + int roomCount = int.Parse(Console.ReadLine()); + Console.WriteLine("Įveskite maksimalią buto kainą:"); + double maxPrice = double.Parse(Console.ReadLine()); + Console.WriteLine("Įveskite žemiausią norimą aukštą [1-9]:"); + int minFloor = int.Parse(Console.ReadLine()); + Console.WriteLine("Įveskite aukščiausią norimą aukštą [{0}-9]:", minFloor); + int maxFloor = int.Parse(Console.ReadLine()); + Console.WriteLine(); + + List filtered = register.FilterByRoomCount(roomCount); + filtered = ApartmentsRegister.FilterByPrice(filtered, maxPrice); + filtered = ApartmentsRegister.FilterByFloor(filtered, minFloor, maxFloor); + + ApartmentsRegister filteredRegister = new ApartmentsRegister(filtered); + Console.WriteLine("Atrinkti butai:"); + InOutUtils.PrintApartments(filteredRegister); + } + } +} diff --git a/Savarankiskas/Savarankiskas.csproj b/Savarankiskas/Savarankiskas.csproj new file mode 100644 index 0000000..72e01c8 --- /dev/null +++ b/Savarankiskas/Savarankiskas.csproj @@ -0,0 +1,14 @@ + + + + Exe + netcoreapp2.1 + + + + + PreserveNewest + + + + From 5dc32eb1f259c8e71d4dd6a6816f0de5f102423a Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Tue, 26 Oct 2021 20:16:38 +0300 Subject: [PATCH 2/8] docs: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a1c6b40..36b8484 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Introduction example project +# Lab2 example project This project is from the "Object oriented programming" course in KTU. From 4e44ccae986e3a99e96fd2e1f4ead09f068f24f7 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Wed, 17 Nov 2021 01:51:37 +0200 Subject: [PATCH 3/8] fix: update output formatting --- Lab2.TouristInformationCenter/InOutUtils.cs | 12 ++++++------ Lab2.TouristInformationCenter/MuseumsRegister.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Lab2.TouristInformationCenter/InOutUtils.cs b/Lab2.TouristInformationCenter/InOutUtils.cs index 1604e81..a2e0886 100644 --- a/Lab2.TouristInformationCenter/InOutUtils.cs +++ b/Lab2.TouristInformationCenter/InOutUtils.cs @@ -132,7 +132,7 @@ namespace Lab2.TouristInformationCenter /// Register containing museums from all files public static MuseumsRegister ReadMuseums(params string[] filenames) { - MuseumsRegister mainRegister = new MuseumsRegister(l); + MuseumsRegister mainRegister = new MuseumsRegister(); foreach (string filename in filenames) { if (filename.EndsWith(".csv")) @@ -199,14 +199,14 @@ namespace Lab2.TouristInformationCenter return; } - Console.WriteLine(new string('-', 115)); - Console.WriteLine("| {0,20} | {1,-10} | {2,20} | {3,-10} | {4,-18} | {5,-3} | {6,-4} |", "Vardas", "Miestas", "Atsakingas", "Tipas", "Darbo dienų kiekis", "Kaina", "Turi gidą?"); - Console.WriteLine(new string('-', 115)); + Console.WriteLine(new string('-', 120)); + Console.WriteLine("| {0,-20} | {1,-10} | {2,-20} | {3,-10} | {4,18} | {5,10} | {6,-4} |", "Vardas", "Miestas", "Atsakingas", "Tipas", "Darbo dienų kiekis", "Kaina", "Turi gidą?"); + Console.WriteLine(new string('-', 120)); foreach (Museum m in museums) { - Console.WriteLine("| {0,20} | {1,-10} | {2, 20} | {3,-10} | {4,-18} | {5,-5:f2} | {6,-10} |", m.Name, m.City, m.Manager, m.Type, m.Workdays.Count, m.Price, m.HasGuide ? "Taip" : "Ne"); + Console.WriteLine("| {0,-20} | {1,-10} | {2,-20} | {3,-10} | {4,18} | {5,10:f2} | {6,-10} |", m.Name, m.City, m.Manager, m.Type, m.Workdays.Count, m.Price, m.HasGuide ? "Taip" : "Ne"); } - Console.WriteLine(new string('-', 115)); + Console.WriteLine(new string('-', 120)); } /// diff --git a/Lab2.TouristInformationCenter/MuseumsRegister.cs b/Lab2.TouristInformationCenter/MuseumsRegister.cs index b04a3b5..ef544fe 100644 --- a/Lab2.TouristInformationCenter/MuseumsRegister.cs +++ b/Lab2.TouristInformationCenter/MuseumsRegister.cs @@ -78,7 +78,7 @@ namespace Lab2.TouristInformationCenter /// Find museum that work the most days in a week /// /// Most active museum - private static Museum FindMostActiveMuseum() + private Museum FindMostActiveMuseum() { if (AllMuseums.Count == 0) { From 78ebb1d628e52fe6bae3e96b67cace9c8bc03507 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Wed, 17 Nov 2021 01:51:52 +0200 Subject: [PATCH 4/8] feat: add tests --- Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv | 7 +++++++ Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv | 8 ++++++++ Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv | 8 ++++++++ Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv | 7 +++++++ 4 files changed, 30 insertions(+) create mode 100644 Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv create mode 100644 Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv create mode 100644 Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv create mode 100644 Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv diff --git a/Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv b/Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv new file mode 100644 index 0000000..681bd90 --- /dev/null +++ b/Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv @@ -0,0 +1,7 @@ +Kaunas +Jonas Jonaitis +KaunoMuziejus1;Dailė;1;0;0;0;1;0;1;3,40;0 +KaunoMuziejus2;Computer;1;1;0;1;1;1;1;14,39;1 +KaunoMuziejus3;History;0;1;0;0;1;0;0;3,26;0 +KaunoMuziejus4;Dailė;0;1;0;1;1;0;1;9,47;1 +KaunoMuziejus5;Space;1;1;0;0;0;0;1;1,99;0 diff --git a/Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv b/Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv new file mode 100644 index 0000000..6fda4c5 --- /dev/null +++ b/Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv @@ -0,0 +1,8 @@ +Vilnius +Petras Petraitis +VilnausMuziejus1;History;1;1;0;1;1;0;0;5,49;0 +VilnausMuziejus2;Computer;1;1;0;1;1;1;1;4,69;1 +VilnausMuziejus3;Dailė;0;1;1;1;1;0;0;1,23;1 +VilnausMuziejus4;Food;1;1;1;1;1;1;0;6,90;1 +VilnausMuziejus5;History;0;1;0;1;1;0;1;10,49;0 +VilnausMuziejus6;Space;1;1;0;1;0;0;0;1,00;0 diff --git a/Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv b/Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv new file mode 100644 index 0000000..c480616 --- /dev/null +++ b/Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv @@ -0,0 +1,8 @@ +Kaunas +Jonas Jonaitis +KaunoMuziejus1;Dailė;1;0;0;0;1;0;1;3,40;0 +KaunoMuziejus2;Computer;1;1;0;1;1;1;1;14,39;1 +KaunoMuziejus3;History;0;1;0;0;1;0;0;3,26;0 +KaunoMuziejus4;Dailė;0;1;0;1;1;0;1;9,47;1 +KaunoMuziejus5;Space;1;1;0;0;0;0;1;1,99;1 +KaunoMuziejus6;Space;1;1;1;1;1;1;1;0,99;1 diff --git a/Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv b/Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv new file mode 100644 index 0000000..f418c38 --- /dev/null +++ b/Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv @@ -0,0 +1,7 @@ +Vilnius +Petras Petraitis +VilnausMuziejus1;Dailė;1;0;0;1;1;0;0;5,49;0 +VilnausMuziejus2;Computer;1;1;0;1;1;1;1;4,69;1 +VilnausMuziejus3;Dailė;0;1;1;1;1;0;0;1,23;0 +VilnausMuziejus4;Food;1;1;1;1;1;1;0;6,90;0 +VilnausMuziejus5;History;0;1;0;1;1;0;1;10,49;0 From 00f5ee6be939abb950abbd9852a084ca638ba2c4 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Wed, 17 Nov 2021 02:03:37 +0200 Subject: [PATCH 5/8] fix: correct solution filename --- Lab2.Exercises.sln => Lab2.sln | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Lab2.Exercises.sln => Lab2.sln (100%) diff --git a/Lab2.Exercises.sln b/Lab2.sln similarity index 100% rename from Lab2.Exercises.sln rename to Lab2.sln From 28172cbd01b5a29d5b0c2cb06cd297987590da16 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Thu, 25 Nov 2021 03:15:22 +0200 Subject: [PATCH 6/8] fix: add editorconfig --- .editorconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3159b2a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root=true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = tab +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.cs] +indent_style = space +indent_size = 4 + From 7de832e7e05768dafcb77df16d3465afe8765b8a Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Thu, 25 Nov 2021 16:37:59 +0200 Subject: [PATCH 7/8] fix: add dotnet cli config --- global.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 global.json diff --git a/global.json b/global.json new file mode 100644 index 0000000..4aa91ae --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "3.0.103" + } +} From 88c9995144d97041ae9090cc0c4baee7e5576ed6 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Wed, 8 Dec 2021 21:00:15 +0200 Subject: [PATCH 8/8] fix: move all files to 'Lab2' --- .editorconfig => Lab2/.editorconfig | 0 .gitignore => Lab2/.gitignore | 0 {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Dog.cs | 0 .../Lab2.Exercises.Register}/Dogs.csv | 0 .../Lab2.Exercises.Register}/DogsRegister.cs | 0 .../Lab2.Exercises.Register}/Gender.cs | 0 .../Lab2.Exercises.Register}/InOutUtils.cs | 0 .../Lab2.Exercises.Register}/Lab2.Exercises.Register.csproj | 0 .../Lab2.Exercises.Register}/Program.cs | 0 .../Lab2.Exercises.Register}/TaskUtils.cs | 0 .../Lab2.Exercises.Register}/Vaccination.cs | 0 .../Lab2.Exercises.Register}/Vaccinations.csv | 0 .../Lab2.TouristInformationCenter}/InOutUtils.cs | 0 .../Lab2.TouristInformationCenter.csproj | 0 .../Lab2.TouristInformationCenter}/Museum.cs | 0 .../Lab2.TouristInformationCenter}/MuseumsKaunas.csv | 0 .../Lab2.TouristInformationCenter}/MuseumsRegister.cs | 0 .../Lab2.TouristInformationCenter}/MuseumsVilnius.csv | 0 .../Lab2.TouristInformationCenter}/Program.cs | 0 .../Lab2.TouristInformationCenter}/Weekday.cs | 0 .../Lab2.TouristInformationCenter}/tests/1/MuseumsKaunas.csv | 0 .../Lab2.TouristInformationCenter}/tests/1/MuseumsVilnius.csv | 0 .../Lab2.TouristInformationCenter}/tests/2/MuseumsKaunas.csv | 0 .../Lab2.TouristInformationCenter}/tests/2/MuseumsVilnius.csv | 0 Lab2.sln => Lab2/Lab2.sln | 0 README.md => Lab2/README.md | 0 {Savarankiskas => Lab2/Savarankiskas}/Apartment.cs | 0 {Savarankiskas => Lab2/Savarankiskas}/Apartments.csv | 0 {Savarankiskas => Lab2/Savarankiskas}/ApartmentsRegister.cs | 0 {Savarankiskas => Lab2/Savarankiskas}/InOutUtils.cs | 0 {Savarankiskas => Lab2/Savarankiskas}/Program.cs | 0 {Savarankiskas => Lab2/Savarankiskas}/Savarankiskas.csproj | 0 global.json => Lab2/global.json | 0 33 files changed, 0 insertions(+), 0 deletions(-) rename .editorconfig => Lab2/.editorconfig (100%) rename .gitignore => Lab2/.gitignore (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Dog.cs (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Dogs.csv (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/DogsRegister.cs (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Gender.cs (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/InOutUtils.cs (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Lab2.Exercises.Register.csproj (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Program.cs (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/TaskUtils.cs (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Vaccination.cs (100%) rename {Lab2.Exercises.Register => Lab2/Lab2.Exercises.Register}/Vaccinations.csv (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/InOutUtils.cs (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/Lab2.TouristInformationCenter.csproj (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/Museum.cs (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/MuseumsKaunas.csv (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/MuseumsRegister.cs (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/MuseumsVilnius.csv (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/Program.cs (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/Weekday.cs (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/tests/1/MuseumsKaunas.csv (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/tests/1/MuseumsVilnius.csv (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/tests/2/MuseumsKaunas.csv (100%) rename {Lab2.TouristInformationCenter => Lab2/Lab2.TouristInformationCenter}/tests/2/MuseumsVilnius.csv (100%) rename Lab2.sln => Lab2/Lab2.sln (100%) rename README.md => Lab2/README.md (100%) rename {Savarankiskas => Lab2/Savarankiskas}/Apartment.cs (100%) rename {Savarankiskas => Lab2/Savarankiskas}/Apartments.csv (100%) rename {Savarankiskas => Lab2/Savarankiskas}/ApartmentsRegister.cs (100%) rename {Savarankiskas => Lab2/Savarankiskas}/InOutUtils.cs (100%) rename {Savarankiskas => Lab2/Savarankiskas}/Program.cs (100%) rename {Savarankiskas => Lab2/Savarankiskas}/Savarankiskas.csproj (100%) rename global.json => Lab2/global.json (100%) diff --git a/.editorconfig b/Lab2/.editorconfig similarity index 100% rename from .editorconfig rename to Lab2/.editorconfig diff --git a/.gitignore b/Lab2/.gitignore similarity index 100% rename from .gitignore rename to Lab2/.gitignore diff --git a/Lab2.Exercises.Register/Dog.cs b/Lab2/Lab2.Exercises.Register/Dog.cs similarity index 100% rename from Lab2.Exercises.Register/Dog.cs rename to Lab2/Lab2.Exercises.Register/Dog.cs diff --git a/Lab2.Exercises.Register/Dogs.csv b/Lab2/Lab2.Exercises.Register/Dogs.csv similarity index 100% rename from Lab2.Exercises.Register/Dogs.csv rename to Lab2/Lab2.Exercises.Register/Dogs.csv diff --git a/Lab2.Exercises.Register/DogsRegister.cs b/Lab2/Lab2.Exercises.Register/DogsRegister.cs similarity index 100% rename from Lab2.Exercises.Register/DogsRegister.cs rename to Lab2/Lab2.Exercises.Register/DogsRegister.cs diff --git a/Lab2.Exercises.Register/Gender.cs b/Lab2/Lab2.Exercises.Register/Gender.cs similarity index 100% rename from Lab2.Exercises.Register/Gender.cs rename to Lab2/Lab2.Exercises.Register/Gender.cs diff --git a/Lab2.Exercises.Register/InOutUtils.cs b/Lab2/Lab2.Exercises.Register/InOutUtils.cs similarity index 100% rename from Lab2.Exercises.Register/InOutUtils.cs rename to Lab2/Lab2.Exercises.Register/InOutUtils.cs diff --git a/Lab2.Exercises.Register/Lab2.Exercises.Register.csproj b/Lab2/Lab2.Exercises.Register/Lab2.Exercises.Register.csproj similarity index 100% rename from Lab2.Exercises.Register/Lab2.Exercises.Register.csproj rename to Lab2/Lab2.Exercises.Register/Lab2.Exercises.Register.csproj diff --git a/Lab2.Exercises.Register/Program.cs b/Lab2/Lab2.Exercises.Register/Program.cs similarity index 100% rename from Lab2.Exercises.Register/Program.cs rename to Lab2/Lab2.Exercises.Register/Program.cs diff --git a/Lab2.Exercises.Register/TaskUtils.cs b/Lab2/Lab2.Exercises.Register/TaskUtils.cs similarity index 100% rename from Lab2.Exercises.Register/TaskUtils.cs rename to Lab2/Lab2.Exercises.Register/TaskUtils.cs diff --git a/Lab2.Exercises.Register/Vaccination.cs b/Lab2/Lab2.Exercises.Register/Vaccination.cs similarity index 100% rename from Lab2.Exercises.Register/Vaccination.cs rename to Lab2/Lab2.Exercises.Register/Vaccination.cs diff --git a/Lab2.Exercises.Register/Vaccinations.csv b/Lab2/Lab2.Exercises.Register/Vaccinations.csv similarity index 100% rename from Lab2.Exercises.Register/Vaccinations.csv rename to Lab2/Lab2.Exercises.Register/Vaccinations.csv diff --git a/Lab2.TouristInformationCenter/InOutUtils.cs b/Lab2/Lab2.TouristInformationCenter/InOutUtils.cs similarity index 100% rename from Lab2.TouristInformationCenter/InOutUtils.cs rename to Lab2/Lab2.TouristInformationCenter/InOutUtils.cs diff --git a/Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj b/Lab2/Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj similarity index 100% rename from Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj rename to Lab2/Lab2.TouristInformationCenter/Lab2.TouristInformationCenter.csproj diff --git a/Lab2.TouristInformationCenter/Museum.cs b/Lab2/Lab2.TouristInformationCenter/Museum.cs similarity index 100% rename from Lab2.TouristInformationCenter/Museum.cs rename to Lab2/Lab2.TouristInformationCenter/Museum.cs diff --git a/Lab2.TouristInformationCenter/MuseumsKaunas.csv b/Lab2/Lab2.TouristInformationCenter/MuseumsKaunas.csv similarity index 100% rename from Lab2.TouristInformationCenter/MuseumsKaunas.csv rename to Lab2/Lab2.TouristInformationCenter/MuseumsKaunas.csv diff --git a/Lab2.TouristInformationCenter/MuseumsRegister.cs b/Lab2/Lab2.TouristInformationCenter/MuseumsRegister.cs similarity index 100% rename from Lab2.TouristInformationCenter/MuseumsRegister.cs rename to Lab2/Lab2.TouristInformationCenter/MuseumsRegister.cs diff --git a/Lab2.TouristInformationCenter/MuseumsVilnius.csv b/Lab2/Lab2.TouristInformationCenter/MuseumsVilnius.csv similarity index 100% rename from Lab2.TouristInformationCenter/MuseumsVilnius.csv rename to Lab2/Lab2.TouristInformationCenter/MuseumsVilnius.csv diff --git a/Lab2.TouristInformationCenter/Program.cs b/Lab2/Lab2.TouristInformationCenter/Program.cs similarity index 100% rename from Lab2.TouristInformationCenter/Program.cs rename to Lab2/Lab2.TouristInformationCenter/Program.cs diff --git a/Lab2.TouristInformationCenter/Weekday.cs b/Lab2/Lab2.TouristInformationCenter/Weekday.cs similarity index 100% rename from Lab2.TouristInformationCenter/Weekday.cs rename to Lab2/Lab2.TouristInformationCenter/Weekday.cs diff --git a/Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv b/Lab2/Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv similarity index 100% rename from Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv rename to Lab2/Lab2.TouristInformationCenter/tests/1/MuseumsKaunas.csv diff --git a/Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv b/Lab2/Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv similarity index 100% rename from Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv rename to Lab2/Lab2.TouristInformationCenter/tests/1/MuseumsVilnius.csv diff --git a/Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv b/Lab2/Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv similarity index 100% rename from Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv rename to Lab2/Lab2.TouristInformationCenter/tests/2/MuseumsKaunas.csv diff --git a/Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv b/Lab2/Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv similarity index 100% rename from Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv rename to Lab2/Lab2.TouristInformationCenter/tests/2/MuseumsVilnius.csv diff --git a/Lab2.sln b/Lab2/Lab2.sln similarity index 100% rename from Lab2.sln rename to Lab2/Lab2.sln diff --git a/README.md b/Lab2/README.md similarity index 100% rename from README.md rename to Lab2/README.md diff --git a/Savarankiskas/Apartment.cs b/Lab2/Savarankiskas/Apartment.cs similarity index 100% rename from Savarankiskas/Apartment.cs rename to Lab2/Savarankiskas/Apartment.cs diff --git a/Savarankiskas/Apartments.csv b/Lab2/Savarankiskas/Apartments.csv similarity index 100% rename from Savarankiskas/Apartments.csv rename to Lab2/Savarankiskas/Apartments.csv diff --git a/Savarankiskas/ApartmentsRegister.cs b/Lab2/Savarankiskas/ApartmentsRegister.cs similarity index 100% rename from Savarankiskas/ApartmentsRegister.cs rename to Lab2/Savarankiskas/ApartmentsRegister.cs diff --git a/Savarankiskas/InOutUtils.cs b/Lab2/Savarankiskas/InOutUtils.cs similarity index 100% rename from Savarankiskas/InOutUtils.cs rename to Lab2/Savarankiskas/InOutUtils.cs diff --git a/Savarankiskas/Program.cs b/Lab2/Savarankiskas/Program.cs similarity index 100% rename from Savarankiskas/Program.cs rename to Lab2/Savarankiskas/Program.cs diff --git a/Savarankiskas/Savarankiskas.csproj b/Lab2/Savarankiskas/Savarankiskas.csproj similarity index 100% rename from Savarankiskas/Savarankiskas.csproj rename to Lab2/Savarankiskas/Savarankiskas.csproj diff --git a/global.json b/Lab2/global.json similarity index 100% rename from global.json rename to Lab2/global.json