diff --git a/.gitignore b/.gitignore index 6acf205..715adb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,354 @@ -################################################################################ -# Ten plik .gitignore został utworzony automatycznie przez Microsoft(R) Visual Studio. -################################################################################ - -/.vs -/Lesson0/.vs/Lesson0/v15 -/Lesson0/Lesson0/obj -/Lesson0/Lesson0/bin/Debug/netcoreapp2.0 -/Lesson1/.vs/Lesson1/v15 -/Lesson1/Lesson1/obj -/Lesson1/Lesson1/bin/Debug/netcoreapp2.0 -/Lesson2/.vs/Lesson2/v15 -/Lesson2/Lesson2/obj +## 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/ +[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/ + +# 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 +*.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, .xml, .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 + +# 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/ + diff --git a/Kolokwium/Kolokwium01-150900.sln b/Kolokwium/Kolokwium01-150900.sln new file mode 100644 index 0000000..0374c61 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2036 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kolokwium01-150900", "Kolokwium01-150900\Kolokwium01-150900.csproj", "{972A1A0D-9F58-4BE0-9B06-1E1E5EF3A2DB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {972A1A0D-9F58-4BE0-9B06-1E1E5EF3A2DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {972A1A0D-9F58-4BE0-9B06-1E1E5EF3A2DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {972A1A0D-9F58-4BE0-9B06-1E1E5EF3A2DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {972A1A0D-9F58-4BE0-9B06-1E1E5EF3A2DB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {313A98AC-3225-47E7-A2B6-FAADB8CE935D} + EndGlobalSection +EndGlobal diff --git a/Kolokwium/Kolokwium01-150900/App.config b/Kolokwium/Kolokwium01-150900/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Kolokwium/Kolokwium01-150900/CalculatorClass/Calculator.cs b/Kolokwium/Kolokwium01-150900/CalculatorClass/Calculator.cs new file mode 100644 index 0000000..4509eab --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/CalculatorClass/Calculator.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.CalculatorClass +{ + class Calculator + { + internal int Addition(int a, int b) => a + b; + internal int AddititionTriple(int a, int b, int c) => a + b + c; + internal int Substraction(int a, int b) => a - b; + internal int Multiply(int a, int b) => a * b; + + internal int Division(int a, int b) + { + if (b == 0) throw new System.Exception("Do not divide by a zero! "); + return a / b; + } + + + } +} diff --git a/Kolokwium/Kolokwium01-150900/CalculatorClass/WeirdoCalc.cs b/Kolokwium/Kolokwium01-150900/CalculatorClass/WeirdoCalc.cs new file mode 100644 index 0000000..bcf3bab --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/CalculatorClass/WeirdoCalc.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.CalculatorClass +{ + class WeirdoCalc : Calculator + { + public int AddingModulo(int a, int b) + { + var resultOne = 26 % a; + var resulttwo = 26 % b; + return Addition(resultOne, resulttwo); + } + + public void rootExtraction(int a, int b) + { + var resultOne = Math.Sqrt(a); + var resultTwo = Math.Sqrt(b); + Console.WriteLine($"Sqrt of first value: {resultOne}, Sqrt of second value: {resultTwo}"); + } + + public int TrippleAddition(int a, int b, int c) + { + var resultOne = a; + var resultTwo = b; + var resultThird = c; + return AddititionTriple(a, b, c); + } + + } +} diff --git a/Kolokwium/Kolokwium01-150900/CarClass/Car.cs b/Kolokwium/Kolokwium01-150900/CarClass/Car.cs new file mode 100644 index 0000000..6406d90 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/CarClass/Car.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.CarClass +{ + class Car + { + private float engineCapacity; + private string nrVIN; + public int yearOfProduction; + public string name; + public float avarageConsumption; + + public enum typeOfRoad + { + t_0_8, + t1, + t1_3 + } + + private Car() + { + + } + + public static Car CarCreateObject(float engineCapacity, string nrVIN, int yearOfProduction, string name, + float avarageConsumption) => new Car() + { + engineCapacity = engineCapacity, + nrVIN = nrVIN, + yearOfProduction = yearOfProduction, + name = name, + avarageConsumption = avarageConsumption + }; + + public double CountConsumption(float routeLength, typeOfRoad typeRoad) + { + switch (typeRoad) + { + case Car.typeOfRoad.t_0_8: return this.avarageConsumption * routeLength * 0.8; + default: + case Car.typeOfRoad.t1_3: return this.avarageConsumption * routeLength; + case Car.typeOfRoad.t1: return this.avarageConsumption * routeLength * 1.3; + } + + } + } +} diff --git a/Kolokwium/Kolokwium01-150900/EmployeeClass/Bookkeeper.cs b/Kolokwium/Kolokwium01-150900/EmployeeClass/Bookkeeper.cs new file mode 100644 index 0000000..3f5dbb2 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/EmployeeClass/Bookkeeper.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.EmployerClass +{ + class Bookkeeper : Employer + { + public override void Work() => Console.WriteLine($"Bookkeeper is working at this moment."); + public override void PrintInfo() => Console.WriteLine($"Name: {this.firstName}, Secondname: {this.secondName}"); + + + } +} diff --git a/Kolokwium/Kolokwium01-150900/EmployeeClass/Employee.cs b/Kolokwium/Kolokwium01-150900/EmployeeClass/Employee.cs new file mode 100644 index 0000000..cc09c06 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/EmployeeClass/Employee.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.EmployerClass +{ + class Employer + { + public string firstName; + public string secondName; + public decimal wages; + + public virtual void PrintInfo() => Console.WriteLine($"Name: {this.firstName}, Secondname: {this.secondName}"); + public virtual void Work() => Console.WriteLine($"Employee is working at this moment."); + + + + } +} diff --git a/Kolokwium/Kolokwium01-150900/EmployeeClass/Salesman.cs b/Kolokwium/Kolokwium01-150900/EmployeeClass/Salesman.cs new file mode 100644 index 0000000..3c559a0 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/EmployeeClass/Salesman.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.EmployerClass +{ + class Salesman : Employer + { + public override void Work() => Console.WriteLine($"Salesman is working at this moment."); + public override void PrintInfo() => Console.WriteLine($"Name: {this.firstName}, Secondname: {this.secondName}"); + + + + } +} diff --git a/Kolokwium/Kolokwium01-150900/EmployeeClass/Violinist.cs b/Kolokwium/Kolokwium01-150900/EmployeeClass/Violinist.cs new file mode 100644 index 0000000..cd3e011 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/EmployeeClass/Violinist.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.EmployerClass +{ + class Violinist : Employer + { + public virtual void Work() => Console.WriteLine($"Violnist is working at this moment."); + public override void PrintInfo() => Console.WriteLine($"Name: {this.firstName}, Secondname: {this.secondName}"); + + + } +} diff --git a/Kolokwium/Kolokwium01-150900/Exception/CantCreateATriangle.cs b/Kolokwium/Kolokwium01-150900/Exception/CantCreateATriangle.cs new file mode 100644 index 0000000..222b5b0 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/Exception/CantCreateATriangle.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.Exception +{ + class CantCreateATriangle : System.Exception + { + public CantCreateATriangle() + { + + } + + public CantCreateATriangle(string message) : base(message) + { + + } + + public CantCreateATriangle(string message, System.Exception inner) : base(message, inner) + { + + } + } +} diff --git a/Kolokwium/Kolokwium01-150900/FigureClass/Point.cs b/Kolokwium/Kolokwium01-150900/FigureClass/Point.cs new file mode 100644 index 0000000..ae8f377 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/FigureClass/Point.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.FigureClass +{ + class Point + { + public float x; + public float y; + + public string name_field = $"Point"; + + public override string ToString() => $"[{this.name_field}] {this.x}, {this.y}."; + + public double CountCircumference() => 0.0; + + public void PrintInfo() + { + Console.WriteLine(this); + Console.WriteLine($"Circumference: {this.CountCircumference()}."); + } + public void TakeDataFromInput() + { + string input; + + do + { + Console.Write("X: "); + + input = Console.ReadLine(); + } + while (!float.TryParse(input, out this.x)); + + do + { + + Console.Write("Y: "); + + input = Console.ReadLine(); + } + while (!float.TryParse(input, out this.y)); + + } + + } +} diff --git a/Kolokwium/Kolokwium01-150900/FigureClass/Rectangle.cs b/Kolokwium/Kolokwium01-150900/FigureClass/Rectangle.cs new file mode 100644 index 0000000..44518b0 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/FigureClass/Rectangle.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.FigureClass +{ + class Rectangle + { + public Point a; + public Point b; + public Point c; + public Point d; + + public string name_field = "Rectangle"; + + public object Clone() + { + return this.MemberwiseClone(); + } + + public override string ToString() => $"[{this.name_field}] A: ({this.a.x}, {this.a.y}), B ({this.b.x}, {this.b.y}), C: ({this.c.x}, {this.c.y}), D: ({this.d.x}, {this.d.y})."; + + public double CountCircumference() => (float)Math.Sqrt(Math.Pow(this.b.x - this.a.x, 2) + Math.Pow(this.b.y - this.a.y, 2)) + Math.Sqrt(Math.Pow(this.c.x - this.b.x, 2) + Math.Pow(this.c.y - this.b.y, 2)) + Math.Sqrt(Math.Pow(this.d.x - this.c.x, 2) + Math.Pow(this.d.y - this.c.y, 2)) + Math.Sqrt(Math.Pow(this.a.x - this.d.x, 2) + Math.Pow(this.a.y - this.d.y, 2)); + + public void TakeDataFromInput() + { + var punkty = new List(); + + for (var i = 1; i <= 4; i++) + { + Console.WriteLine($"point {i}"); + + + var punkt = new Point(); + + punkt.TakeDataFromInput(); + + punkty.Add(punkt); + } + + this.a = punkty[0]; + this.b = punkty[1]; + this.c = punkty[2]; + this.d = punkty[3]; + } + + public void PrintInfo() + { + Console.WriteLine(this); + Console.WriteLine($"Circumference: {this.CountCircumference()}."); + } + } +} diff --git a/Kolokwium/Kolokwium01-150900/FigureClass/Triangle.cs b/Kolokwium/Kolokwium01-150900/FigureClass/Triangle.cs new file mode 100644 index 0000000..ea6d9b4 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/FigureClass/Triangle.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Kolokwium01_150900.Exception; +using Kolokwium01_150900.Interfaces; + +namespace Kolokwium01_150900.FigureClass +{ + class Triangle : ICloneable, IFigure + { + public Point a; + public Point b; + public Point c; + + public string name_field = "Triangle"; + + public Triangle() + { + + } + + public Triangle(Point a, Point b, Point c) + { + double ab = Math.Sqrt(Math.Pow(b.x - a.x, 2) + Math.Pow(b.y - a.y, 2)), + ac = Math.Sqrt(Math.Pow(c.x - a.x, 2) + Math.Pow(c.y - a.y, 2)), + bc = Math.Sqrt(Math.Pow(c.x - b.x, 2) + Math.Pow(c.y - b.y, 2)); + + if (!(ab + bc > ac) || !(ab + ac > bc) || !(bc + ac > ab)) return; + this.a = a; + this.b = b; + this.c = c; + + throw new CantCreateATriangle(); + } + + public object Clone() + { + return this.MemberwiseClone(); + } + + public override string ToString() => + $"Name {this.name_field} : A: {this.a.x}, {this.a.y}, B: {this.b.x} {this.b.y}, C: {this.c.x} {this.c.y}"; + + public double CountCircumference() + { + return (float)Math.Sqrt(Math.Pow(this.b.x - this.a.x, 2) + Math.Pow(this.b.y - this.a.y, 2)) + Math.Sqrt(Math.Pow(this.c.x - this.b.x, 2) + Math.Pow(this.c.y - this.b.y, 2)) + Math.Sqrt(Math.Pow(this.c.x - this.a.x, 2) + Math.Pow(this.c.y - this.a.y, 2)); + } + public void TakeDataFromInput() + { + var points = new List(); + + for (var i = 1; i <= 3; i++) + { + Console.WriteLine($"point {i}"); + + var point = new Point(); + + point.TakeDataFromInput(); + + points.Add(point); + } + + double ab = Math.Sqrt(Math.Pow(points[1].x - points[0].x, 2) + Math.Pow(points[1].y - points[0].y, 2)), bc = Math.Sqrt(Math.Pow(points[2].x - points[1].x, 2) + Math.Pow(points[2].y - points[1].y, 2)), ac = Math.Sqrt(Math.Pow(points[2].x - points[0].x, 2) + Math.Pow(points[2].y - points[1].y, 2)); + + if (ab + bc <= ac || ab + ac <= bc || bc + ac <= ab) throw new CantCreateATriangle(); + + this.a = points[0]; + this.b = points[1]; + this.c = points[2]; + } + + public void Print() + { + Console.WriteLine(this); + Console.WriteLine($"Circumference: {this.CountCircumference()}."); + } + + public void PrintInfo() + { + Console.WriteLine(this); + Console.WriteLine($"Circumference: {this.CountCircumference()}"); + } + + + } +} diff --git a/Kolokwium/Kolokwium01-150900/Interfaces/IFigure.cs b/Kolokwium/Kolokwium01-150900/Interfaces/IFigure.cs new file mode 100644 index 0000000..4c5b48e --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/Interfaces/IFigure.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.Interfaces +{ + interface IFigure + { + double CountCircumference(); + void TakeDataFromInput(); + void Print(); + } +} diff --git a/Kolokwium/Kolokwium01-150900/Interfaces/IPerson.cs b/Kolokwium/Kolokwium01-150900/Interfaces/IPerson.cs new file mode 100644 index 0000000..13549a5 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/Interfaces/IPerson.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Kolokwium01_150900.Interfaces +{ + interface IPerson + { + void Describe(); + + } +} diff --git a/Kolokwium/Kolokwium01-150900/Kolokwium01-150900.csproj b/Kolokwium/Kolokwium01-150900/Kolokwium01-150900.csproj new file mode 100644 index 0000000..0e20968 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/Kolokwium01-150900.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {972A1A0D-9F58-4BE0-9B06-1E1E5EF3A2DB} + Exe + Kolokwium01_150900 + Kolokwium01-150900 + v4.6.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Kolokwium/Kolokwium01-150900/Program.cs b/Kolokwium/Kolokwium01-150900/Program.cs new file mode 100644 index 0000000..ef5aa6d --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/Program.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Kolokwium01_150900.EmployerClass; +using Kolokwium01_150900.CarClass; +using Kolokwium01_150900.Exception; +using Kolokwium01_150900.FigureClass; +using Kolokwium01_150900.StudentClass; + +namespace Kolokwium01_150900 +{ + class Program + { + public static string GetType(int variable) => $"Type: int"; + public static string GetType(string str) => $"Type: string"; + public static string GetType(int a, string b) => $"Type: int, Type: string"; + public static string GetType(bool boolean) => $"Type: boolean"; + public static string GetType(int a, int b, bool c) => $"Type: int, Type: int, Type: boolean"; + + static void Main(string[] args) + { + //ex1 + var newCar = Car.CarCreateObject(500F, "254FC", 2005, "Fiat", 2.0F); + var secondCar = Car.CarCreateObject(250F, "25EC", 2000, "Audi", 2.0F); + + Console.WriteLine($"Consumption: {newCar.CountConsumption((float)500.4, Car.typeOfRoad.t1)}"); + Console.WriteLine($"Consumption: {secondCar.CountConsumption((float)234.2, Car.typeOfRoad.t_0_8)}"); + //ex2 + int b = 4; + Console.WriteLine($"{Program.GetType(b)}"); + string str = "test"; + Console.WriteLine($"{Program.GetType(str)}"); + b = 5; + str = "test2"; + Console.WriteLine($"{Program.GetType(b, str)}"); + bool bol = false; + Program.GetType(bol); + Console.WriteLine($"{Program.GetType(bol)}"); + int a = 5; + b = 4; + bol = true; + Console.WriteLine($"{Program.GetType(a, b, bol)}"); + // ex4 + + var employers = new List(); + + var test = new Employer(); + test.firstName = "test"; + test.secondName = "test"; + var test2 = new Violinist(); + test2.firstName = "Test2"; + test2.secondName = "Test2"; + var test3 = new Bookkeeper(); + test3.firstName = "test3"; + test3.secondName = "test3"; + var test4 = new Salesman(); + test4.firstName = "test4"; + test4.secondName = "test4"; + + employers.Add(test); + employers.Add(test2); + employers.Add(test3); + employers.Add(test4); + + foreach (var i in employers) + { + Console.WriteLine($"name: {i.firstName}, secondname: {i.secondName}"); + i.Work(); + } + + //EX5 + + var student = new Student("Juan", "Pablo"); + var studentOne = new Student("Test", "Test"); + var studentThree = new Student("Arek", "Cieloszczyk"); + var studentFour = new Student("Bartek", "Test"); + var studentFive = new Student("Ksfkasf", "dasdas"); + var studentSix = new Student("Ksfkasf", "Zdasdas"); + + var students = new List(); + + students.Add(student); + students.Add(studentOne); + students.Add(studentThree); + students.Add(studentFour); + students.Add(studentFive); + students.Add(studentSix); + + + var sortedList = students.OrderBy(x => x.secondName); + + foreach (var i in students) + { + Console.WriteLine($"{i.name}, {i.secondName}"); + } + + //ex with figure + + var d = new Point(); + + d.TakeDataFromInput(); + d.PrintInfo(); + + var f = new Triangle(); + + try + { + f.TakeDataFromInput(); + f.PrintInfo(); + } + catch (CantCreateATriangle) + { + Console.WriteLine("Can't create a triangle."); + } + catch (System.Exception e) + { + Console.WriteLine(e); + } + + var g = new Rectangle(); + + g.TakeDataFromInput(); + g.PrintInfo(); + + + Console.ReadKey(); + } + } +} diff --git a/Kolokwium/Kolokwium01-150900/Properties/AssemblyInfo.cs b/Kolokwium/Kolokwium01-150900/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..aa17757 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Ogólne informacje o zestawie są kontrolowane poprzez następujący +// zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje +// powiązane z zestawem. +[assembly: AssemblyTitle("Kolokwium01-150900")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Kolokwium01-150900")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne +// dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z +// COM, ustaw wartość true dla atrybutu ComVisible tego typu. +[assembly: ComVisible(false)] + +// Następujący identyfikator GUID jest identyfikatorem biblioteki typów w przypadku udostępnienia tego projektu w modelu COM +[assembly: Guid("972a1a0d-9f58-4be0-9b06-1e1e5ef3a2db")] + +// Informacje o wersji zestawu zawierają następujące cztery wartości: +// +// Wersja główna +// Wersja pomocnicza +// Numer kompilacji +// Rewizja +// +// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki +// przy użyciu symbolu „*”, tak jak pokazano poniżej: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Kolokwium/Kolokwium01-150900/StudentClass/Student.cs b/Kolokwium/Kolokwium01-150900/StudentClass/Student.cs new file mode 100644 index 0000000..9882a51 --- /dev/null +++ b/Kolokwium/Kolokwium01-150900/StudentClass/Student.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Kolokwium01_150900.Interfaces; + +namespace Kolokwium01_150900.StudentClass +{ + class Student : IPerson + { + + public string name; + public string secondName; + + public Student(string name, string secondName) + { + this.name = name; + this.secondName = secondName; + } + + public void Describe() + { + throw new NotImplementedException(); + } + } +} diff --git a/Lesson11/.vs/Lesson11/v16/.suo b/Lesson11/.vs/Lesson11/v16/.suo new file mode 100644 index 0000000..cc5298f Binary files /dev/null and b/Lesson11/.vs/Lesson11/v16/.suo differ diff --git a/Lesson11/.vs/Lesson11/v16/Server/sqlite3/db.lock b/Lesson11/.vs/Lesson11/v16/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/Lesson11/.vs/Lesson11/v16/Server/sqlite3/storage.ide b/Lesson11/.vs/Lesson11/v16/Server/sqlite3/storage.ide new file mode 100644 index 0000000..de1cb7d Binary files /dev/null and b/Lesson11/.vs/Lesson11/v16/Server/sqlite3/storage.ide differ diff --git a/Lesson11/Lesson11.sln b/Lesson11/Lesson11.sln new file mode 100644 index 0000000..137f518 --- /dev/null +++ b/Lesson11/Lesson11.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29609.76 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson11", "Lesson11\Lesson11.csproj", "{1D3D4D8C-B601-4609-81F7-A1CA622204F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1D3D4D8C-B601-4609-81F7-A1CA622204F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D3D4D8C-B601-4609-81F7-A1CA622204F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D3D4D8C-B601-4609-81F7-A1CA622204F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D3D4D8C-B601-4609-81F7-A1CA622204F3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E7F8A8D0-B285-4942-AD31-EF9601D672DD} + EndGlobalSection +EndGlobal diff --git a/Lesson11/Lesson11/App.config b/Lesson11/Lesson11/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Lesson11/Lesson11/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lesson11/Lesson11/App.xaml b/Lesson11/Lesson11/App.xaml new file mode 100644 index 0000000..0dd66ed --- /dev/null +++ b/Lesson11/Lesson11/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Lesson11/Lesson11/App.xaml.cs b/Lesson11/Lesson11/App.xaml.cs new file mode 100644 index 0000000..4a0aba6 --- /dev/null +++ b/Lesson11/Lesson11/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Lesson11 +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/Lesson11/Lesson11/Lesson11.csproj b/Lesson11/Lesson11/Lesson11.csproj new file mode 100644 index 0000000..3831908 --- /dev/null +++ b/Lesson11/Lesson11/Lesson11.csproj @@ -0,0 +1,98 @@ + + + + + Debug + AnyCPU + {1D3D4D8C-B601-4609-81F7-A1CA622204F3} + WinExe + Lesson11 + Lesson11 + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/Lesson11/Lesson11/MainWindow.xaml b/Lesson11/Lesson11/MainWindow.xaml new file mode 100644 index 0000000..0b5d453 --- /dev/null +++ b/Lesson11/Lesson11/MainWindow.xaml @@ -0,0 +1,18 @@ + + + + + + diff --git a/Library/LibrarryLesson11/AddingBook.xaml.cs b/Library/LibrarryLesson11/AddingBook.xaml.cs new file mode 100644 index 0000000..857745f --- /dev/null +++ b/Library/LibrarryLesson11/AddingBook.xaml.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Windows; + +namespace LibrarryLesson11 +{ + /// + /// Interaction logic for AddingBook.xaml + /// + public partial class AddingBook : Window + { + public AddingBook() + { + InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + + var new_catalogue = new Catalogue(); + + if (!(authorfirstname_tb.Text == "" || asurname_tb.Text == "" || btitle_tb.Text == "" || + id_name_tb.Text == "" || bpublisher_tb.Text == "" || yop_tb.Text == "" || nop_tb.Text == "")) + { + int.TryParse(yop_tb.Text, out var output); + int.TryParse(nop_tb.Text, out var output2); + int.TryParse(id_name_tb.Text, out var output3); + + if (output3 > 0 || output2 > 0 || output > 0) + { + MainWindow.Library.ListOfPositions.Add(new Book(authorfirstname_tb.Text, asurname_tb.Text, + btitle_tb.Text, + output2, bpublisher_tb.Text, output, + output3)); + MessageBox.Show("Book has been added successfully."); + } + else + MessageBox.Show("Invalid input with number fields."); + } + else + MessageBox.Show("You should fill all text boxes."); + + } + + private void exit_button_click(object sender, RoutedEventArgs e) + { + this.Close(); + } + } +} diff --git a/Library/LibrarryLesson11/AddingJournal.xaml b/Library/LibrarryLesson11/AddingJournal.xaml new file mode 100644 index 0000000..776b4e8 --- /dev/null +++ b/Library/LibrarryLesson11/AddingJournal.xaml @@ -0,0 +1,24 @@ + + +