From d997d7fc3c8d3ddc62ef3705dd6712a91848620a Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Sat, 15 Oct 2016 07:33:37 +0300 Subject: [PATCH 01/12] Task 1 is done --- .gitignore | 193 ++++++++++++++++++ PisotskiyPavel/Task_1/Task_1.sln | 124 +++++++++++ .../Task_1_1_DisplayFullName/App.config | 6 + .../Task_1_1_DisplayFullName/Program.cs | 24 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_1_DisplayFullName.csproj | 60 ++++++ .../Task_1/Task_1_2_1_MaxNumber/App.config | 6 + .../Task_1/Task_1_2_1_MaxNumber/Program.cs | 34 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_1_MaxNumber.csproj | 60 ++++++ .../Task_1/Task_1_2_2_Animals/App.config | 6 + .../Task_1/Task_1_2_2_Animals/Program.cs | 34 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_2_Animals.csproj | 60 ++++++ .../Task_1/Task_1_2_3_Seasons/App.config | 6 + .../Task_1/Task_1_2_3_Seasons/Program.cs | 53 +++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_3_Seasons.csproj | 60 ++++++ .../Task_1/Task_1_2_4_GoodOrBad/App.config | 6 + .../Task_1/Task_1_2_4_GoodOrBad/Program.cs | 20 ++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_4_GoodOrBad.csproj | 60 ++++++ .../Task_1/Task_1_2_5_DayOfWeek/App.config | 6 + .../Task_1/Task_1_2_5_DayOfWeek/Program.cs | 38 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_5_DayOfWeek.csproj | 60 ++++++ .../Task_1/Task_1_2_6_Taxi/App.config | 6 + .../Task_1/Task_1_2_6_Taxi/Program.cs | 40 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_6_Taxi/Task_1_2_6_Taxi.csproj | 60 ++++++ .../Task_1/Task_1_2_7_SimpleNumber/App.config | 6 + .../Task_1/Task_1_2_7_SimpleNumber/Program.cs | 41 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_7_SimpleNumber.csproj | 60 ++++++ .../Task_1/Task_1_2_8_Lottery/App.config | 6 + .../Task_1/Task_1_2_8_Lottery/Program.cs | 50 +++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_8_Lottery.csproj | 60 ++++++ .../Task_1_2_9_CurrencyConverter/App.config | 6 + .../Currencies.cs | 15 ++ .../Task_1_2_9_CurrencyConverter/Currency.cs | 18 ++ .../CurrencyConverter.cs | 68 ++++++ .../Task_1_2_9_CurrencyConverter/Program.cs | 39 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_2_9_CurrencyConverter.csproj | 63 ++++++ .../Task_1_3_1_MultiplicationTable/App.config | 6 + .../Task_1_3_1_MultiplicationTable/Program.cs | 27 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_1_MultiplicationTable.csproj | 60 ++++++ .../Task_1/Task_1_3_2_NumberRange/App.config | 6 + .../Task_1/Task_1_3_2_NumberRange/Program.cs | 32 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_2_NumberRange.csproj | 60 ++++++ .../Task_1_3_3_GuessTheNumber/App.config | 6 + .../Task_1_3_3_GuessTheNumber/Program.cs | 45 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_3_GuessTheNumber.csproj | 60 ++++++ .../Task_1/Task_1_3_4_SquareNumber/App.config | 6 + .../Task_1/Task_1_3_4_SquareNumber/Program.cs | 37 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_4_SquareNumber.csproj | 60 ++++++ .../Task_1/Task_1_3_5_Average/App.config | 6 + .../Task_1/Task_1_3_5_Average/Program.cs | 40 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_5_Average.csproj | 60 ++++++ .../App.config | 6 + .../Program.cs | 42 ++++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_6_AverageOfRandomNumbers.csproj | 60 ++++++ .../Task_1_3_7_GeeseAndRabbits/App.config | 6 + .../Task_1_3_7_GeeseAndRabbits/Program.cs | 27 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_7_GeeseAndRabbits.csproj | 60 ++++++ .../Task_1/Task_1_3_8_Password/App.config | 6 + .../Task_1/Task_1_3_8_Password/Program.cs | 32 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Task_1_3_8_Password.csproj | 60 ++++++ 77 files changed, 2912 insertions(+) create mode 100644 .gitignore create mode 100644 PisotskiyPavel/Task_1/Task_1.sln create mode 100644 PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Task_1_1_DisplayFullName.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Task_1_2_1_MaxNumber.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_2_Animals/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_2_Animals/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_2_Animals/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_2_Animals/Task_1_2_2_Animals.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_3_Seasons/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Task_1_2_3_Seasons.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Task_1_2_4_GoodOrBad.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Task_1_2_5_DayOfWeek.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_6_Taxi/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Task_1_2_6_Taxi.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Task_1_2_7_SimpleNumber.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_8_Lottery/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Task_1_2_8_Lottery.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currencies.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currency.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/CurrencyConverter.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Task_1_2_9_CurrencyConverter.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Task_1_3_1_MultiplicationTable.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Task_1_3_2_NumberRange.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Task_1_3_3_GuessTheNumber.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Task_1_3_4_SquareNumber.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_5_Average/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_5_Average/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_5_Average/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_5_Average/Task_1_3_5_Average.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Task_1_3_6_AverageOfRandomNumbers.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Task_1_3_7_GeeseAndRabbits.csproj create mode 100644 PisotskiyPavel/Task_1/Task_1_3_8_Password/App.config create mode 100644 PisotskiyPavel/Task_1/Task_1_3_8_Password/Program.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_8_Password/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_1/Task_1_3_8_Password/Task_1_3_8_Password.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16e31d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,193 @@ +# Download this file using PowerShell v3 under Windows with the following comand: +# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore +# or wget: +# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# OS generated files # +.DS_Store* +Icon? + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# 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 +*.Publish.xml + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings +modulesbin/ +tempbin/ + +# EPiServer Site file (VPP) +AppData/ + +# 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 + +# vim +*.txt~ +*.swp +*.swo + +# svn +.svn + +# Remainings from resolvings conflicts in Source Control +*.orig + +# SQL Server files +**/App_Data/*.mdf +**/App_Data/*.ldf +**/App_Data/*.sdf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +# SASS Compiler cache +.sass-cache + +# Visual Studio 2014 CTP +**/*.sln.ide + +# Visual Studio temp something +.vs/ + +##### +# End of core ignore list, below put you custom 'per project' settings (patterns or path) +##### \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1.sln b/PisotskiyPavel/Task_1/Task_1.sln new file mode 100644 index 0000000..ba8d08e --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1.sln @@ -0,0 +1,124 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_1_DisplayFullName", "Task_1_1_DisplayFullName\Task_1_1_DisplayFullName.csproj", "{652513C0-111A-47D5-9611-F3D04B921877}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_1_MaxNumber", "Task_1_2_1_MaxNumber\Task_1_2_1_MaxNumber.csproj", "{0DF3739B-119E-4617-B2ED-C9E73E735854}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_2_Animals", "Task_1_2_2_Animals\Task_1_2_2_Animals.csproj", "{10C3BA46-C5CB-455E-8A1E-0E89FA23A083}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_3_Seasons", "Task_1_2_3_Seasons\Task_1_2_3_Seasons.csproj", "{6FE47AB6-CC93-4A8B-B23A-616554B15BA5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_4_GoodOrBad", "Task_1_2_4_GoodOrBad\Task_1_2_4_GoodOrBad.csproj", "{1AD1FD77-BE65-4406-B18D-C58AC5C3D92C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_5_DayOfWeek", "Task_1_2_5_DayOfWeek\Task_1_2_5_DayOfWeek.csproj", "{603EEE51-5AD4-4E72-A72E-AB8E61513A00}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_6_Taxi", "Task_1_2_6_Taxi\Task_1_2_6_Taxi.csproj", "{687C93A2-A6D0-4955-A57C-AFEE247CCAA8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_7_SimpleNumber", "Task_1_2_7_SimpleNumber\Task_1_2_7_SimpleNumber.csproj", "{B98DBBAD-606B-43D2-BBB3-1AFDBD62AEA7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_8_Lottery", "Task_1_2_8_Lottery\Task_1_2_8_Lottery.csproj", "{ECA16EE3-CC9D-47E0-BAA8-F4201E74B8B1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_2_9_CurrencyConverter", "Task_1_2_9_CurrencyConverter\Task_1_2_9_CurrencyConverter.csproj", "{22D2A9E4-FC41-4D1B-98A2-718568470619}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_1_MultiplicationTable", "Task_1_3_1_MultiplicationTable\Task_1_3_1_MultiplicationTable.csproj", "{46C002F7-54DB-4475-BF2D-FA061928794F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_2_NumberRange", "Task_1_3_2_NumberRange\Task_1_3_2_NumberRange.csproj", "{363AD540-0F02-44E7-9495-38A73FB38169}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_3_GuessTheNumber", "Task_1_3_3_GuessTheNumber\Task_1_3_3_GuessTheNumber.csproj", "{FBA9DFB0-0B54-4AFC-BBC8-9150B165F33A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_4_SquareNumber", "Task_1_3_4_SquareNumber\Task_1_3_4_SquareNumber.csproj", "{349127DE-8616-4AB8-8225-4C92261E331C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_5_Average", "Task_1_3_5_Average\Task_1_3_5_Average.csproj", "{B9876E71-4674-47A2-9D35-590A1A9C6DE9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_6_AverageOfRandomNumbers", "Task_1_3_6_AverageOfRandomNumbers\Task_1_3_6_AverageOfRandomNumbers.csproj", "{91482B71-5DEC-4534-9B88-3C9A1BECC673}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_7_GeeseAndRabbits", "Task_1_3_7_GeeseAndRabbits\Task_1_3_7_GeeseAndRabbits.csproj", "{5F7AAC98-97AC-48F2-A5B4-E8D5FC4B454F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_1_3_8_Password", "Task_1_3_8_Password\Task_1_3_8_Password.csproj", "{F58DA110-C529-48F4-8768-4ECDC47242E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {652513C0-111A-47D5-9611-F3D04B921877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {652513C0-111A-47D5-9611-F3D04B921877}.Debug|Any CPU.Build.0 = Debug|Any CPU + {652513C0-111A-47D5-9611-F3D04B921877}.Release|Any CPU.ActiveCfg = Release|Any CPU + {652513C0-111A-47D5-9611-F3D04B921877}.Release|Any CPU.Build.0 = Release|Any CPU + {0DF3739B-119E-4617-B2ED-C9E73E735854}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0DF3739B-119E-4617-B2ED-C9E73E735854}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0DF3739B-119E-4617-B2ED-C9E73E735854}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0DF3739B-119E-4617-B2ED-C9E73E735854}.Release|Any CPU.Build.0 = Release|Any CPU + {10C3BA46-C5CB-455E-8A1E-0E89FA23A083}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10C3BA46-C5CB-455E-8A1E-0E89FA23A083}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10C3BA46-C5CB-455E-8A1E-0E89FA23A083}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10C3BA46-C5CB-455E-8A1E-0E89FA23A083}.Release|Any CPU.Build.0 = Release|Any CPU + {6FE47AB6-CC93-4A8B-B23A-616554B15BA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FE47AB6-CC93-4A8B-B23A-616554B15BA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FE47AB6-CC93-4A8B-B23A-616554B15BA5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FE47AB6-CC93-4A8B-B23A-616554B15BA5}.Release|Any CPU.Build.0 = Release|Any CPU + {1AD1FD77-BE65-4406-B18D-C58AC5C3D92C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1AD1FD77-BE65-4406-B18D-C58AC5C3D92C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1AD1FD77-BE65-4406-B18D-C58AC5C3D92C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1AD1FD77-BE65-4406-B18D-C58AC5C3D92C}.Release|Any CPU.Build.0 = Release|Any CPU + {603EEE51-5AD4-4E72-A72E-AB8E61513A00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {603EEE51-5AD4-4E72-A72E-AB8E61513A00}.Debug|Any CPU.Build.0 = Debug|Any CPU + {603EEE51-5AD4-4E72-A72E-AB8E61513A00}.Release|Any CPU.ActiveCfg = Release|Any CPU + {603EEE51-5AD4-4E72-A72E-AB8E61513A00}.Release|Any CPU.Build.0 = Release|Any CPU + {687C93A2-A6D0-4955-A57C-AFEE247CCAA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {687C93A2-A6D0-4955-A57C-AFEE247CCAA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {687C93A2-A6D0-4955-A57C-AFEE247CCAA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {687C93A2-A6D0-4955-A57C-AFEE247CCAA8}.Release|Any CPU.Build.0 = Release|Any CPU + {B98DBBAD-606B-43D2-BBB3-1AFDBD62AEA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B98DBBAD-606B-43D2-BBB3-1AFDBD62AEA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B98DBBAD-606B-43D2-BBB3-1AFDBD62AEA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B98DBBAD-606B-43D2-BBB3-1AFDBD62AEA7}.Release|Any CPU.Build.0 = Release|Any CPU + {ECA16EE3-CC9D-47E0-BAA8-F4201E74B8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECA16EE3-CC9D-47E0-BAA8-F4201E74B8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECA16EE3-CC9D-47E0-BAA8-F4201E74B8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECA16EE3-CC9D-47E0-BAA8-F4201E74B8B1}.Release|Any CPU.Build.0 = Release|Any CPU + {22D2A9E4-FC41-4D1B-98A2-718568470619}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22D2A9E4-FC41-4D1B-98A2-718568470619}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22D2A9E4-FC41-4D1B-98A2-718568470619}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22D2A9E4-FC41-4D1B-98A2-718568470619}.Release|Any CPU.Build.0 = Release|Any CPU + {46C002F7-54DB-4475-BF2D-FA061928794F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46C002F7-54DB-4475-BF2D-FA061928794F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46C002F7-54DB-4475-BF2D-FA061928794F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46C002F7-54DB-4475-BF2D-FA061928794F}.Release|Any CPU.Build.0 = Release|Any CPU + {363AD540-0F02-44E7-9495-38A73FB38169}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {363AD540-0F02-44E7-9495-38A73FB38169}.Debug|Any CPU.Build.0 = Debug|Any CPU + {363AD540-0F02-44E7-9495-38A73FB38169}.Release|Any CPU.ActiveCfg = Release|Any CPU + {363AD540-0F02-44E7-9495-38A73FB38169}.Release|Any CPU.Build.0 = Release|Any CPU + {FBA9DFB0-0B54-4AFC-BBC8-9150B165F33A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FBA9DFB0-0B54-4AFC-BBC8-9150B165F33A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FBA9DFB0-0B54-4AFC-BBC8-9150B165F33A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FBA9DFB0-0B54-4AFC-BBC8-9150B165F33A}.Release|Any CPU.Build.0 = Release|Any CPU + {349127DE-8616-4AB8-8225-4C92261E331C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {349127DE-8616-4AB8-8225-4C92261E331C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {349127DE-8616-4AB8-8225-4C92261E331C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {349127DE-8616-4AB8-8225-4C92261E331C}.Release|Any CPU.Build.0 = Release|Any CPU + {B9876E71-4674-47A2-9D35-590A1A9C6DE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9876E71-4674-47A2-9D35-590A1A9C6DE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9876E71-4674-47A2-9D35-590A1A9C6DE9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9876E71-4674-47A2-9D35-590A1A9C6DE9}.Release|Any CPU.Build.0 = Release|Any CPU + {91482B71-5DEC-4534-9B88-3C9A1BECC673}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91482B71-5DEC-4534-9B88-3C9A1BECC673}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91482B71-5DEC-4534-9B88-3C9A1BECC673}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91482B71-5DEC-4534-9B88-3C9A1BECC673}.Release|Any CPU.Build.0 = Release|Any CPU + {5F7AAC98-97AC-48F2-A5B4-E8D5FC4B454F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F7AAC98-97AC-48F2-A5B4-E8D5FC4B454F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F7AAC98-97AC-48F2-A5B4-E8D5FC4B454F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F7AAC98-97AC-48F2-A5B4-E8D5FC4B454F}.Release|Any CPU.Build.0 = Release|Any CPU + {F58DA110-C529-48F4-8768-4ECDC47242E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F58DA110-C529-48F4-8768-4ECDC47242E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F58DA110-C529-48F4-8768-4ECDC47242E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F58DA110-C529-48F4-8768-4ECDC47242E5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/App.config b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Program.cs b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Program.cs new file mode 100644 index 0000000..3864f76 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_1_DisplayFullName +{ + class Program + { + static void Main(string[] args) + { + DisplayFullName("Писоцкий Павел Александрович"); + Console.ReadLine(); + } + + static void DisplayFullName(string fullName) + { + Console.WriteLine("+{0}+", new string('-', fullName.Length)); + Console.WriteLine("|{0}|", fullName); + Console.WriteLine("+{0}+", new string('-', fullName.Length)); + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9b1cff4 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_1_DisplayFullName")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_1_DisplayFullName")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("652513c0-111a-47d5-9611-f3d04b921877")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Task_1_1_DisplayFullName.csproj b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Task_1_1_DisplayFullName.csproj new file mode 100644 index 0000000..32b6195 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_1_DisplayFullName/Task_1_1_DisplayFullName.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {652513C0-111A-47D5-9611-F3D04B921877} + Exe + Properties + Task_1_1_DisplayFullName + Task_1_1_DisplayFullName + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/App.config b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Program.cs new file mode 100644 index 0000000..1eb6f4c --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Program.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_1_MaxNumber +{ + class Program + { + static void Main(string[] args) + { + double firstNumber = GetNumber("Введите первое число:"); + double secondNumber = GetNumber("Введите второе число:"); + + double maxNumber = firstNumber > secondNumber ? firstNumber : secondNumber; + + Console.WriteLine("Максимально число: {0}", maxNumber); + + Console.ReadLine(); + } + + static double GetNumber(string message) + { + Console.WriteLine(message); + double result; + if(!double.TryParse(Console.ReadLine(), out result)) + { + result = GetNumber(message); + } + return result; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c99da7c --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_1_MaxNumber")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_1_MaxNumber")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0df3739b-119e-4617-b2ed-c9e73e735854")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Task_1_2_1_MaxNumber.csproj b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Task_1_2_1_MaxNumber.csproj new file mode 100644 index 0000000..8ff079e --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_1_MaxNumber/Task_1_2_1_MaxNumber.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {0DF3739B-119E-4617-B2ED-C9E73E735854} + Exe + Properties + Task_1_2_1_MaxNumber + Task_1_2_1_MaxNumber + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_2_Animals/App.config b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Program.cs new file mode 100644 index 0000000..7387658 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Program.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_2_Animals +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите \"Мяу\" или \"Гав\":"); + string word = Console.ReadLine().ToLower(); + string result = string.Empty; + if (word.Equals("мяу")) + { + result = "Покорми кота"; + } + else if (word.Equals("гав")) + { + result = "Погуляй с собакой"; + } + else + { + result = "Вы ввели не корректное слово."; + } + + Console.WriteLine(result); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d6940c4 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_2_Animals")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_2_Animals")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("10c3ba46-c5cb-455e-8a1e-0e89fa23a083")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Task_1_2_2_Animals.csproj b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Task_1_2_2_Animals.csproj new file mode 100644 index 0000000..4662efc --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_2_Animals/Task_1_2_2_Animals.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {10C3BA46-C5CB-455E-8A1E-0E89FA23A083} + Exe + Properties + Task_1_2_2_Animals + Task_1_2_2_Animals + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/App.config b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Program.cs new file mode 100644 index 0000000..10e0d99 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Program.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_3_Seasons +{ + class Program + { + static void Main(string[] args) + { + Console.Write("Введите номер месяца: "); + int month = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine(GetSeasonByNumber(month)); + Console.ReadLine(); + } + + static string GetSeasonByNumber(int number) + { + string result = string.Empty; + + switch (number) + { + case 12: + case 1: + case 2: + result = "Зима"; break; + + case 3: + case 4: + case 5: + result = "Весна"; break; + + case 6: + case 7: + case 8: + result = "Лето"; break; + + case 9: + case 10: + case 11: + result = "Осень"; break; + + default: + result = "На этой планете такого месяца нет."; + break; + } + + return result; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..021b4f2 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_3_Seasons")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_3_Seasons")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6fe47ab6-cc93-4a8b-b23a-616554b15ba5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Task_1_2_3_Seasons.csproj b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Task_1_2_3_Seasons.csproj new file mode 100644 index 0000000..4153117 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_3_Seasons/Task_1_2_3_Seasons.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {6FE47AB6-CC93-4A8B-B23A-616554B15BA5} + Exe + Properties + Task_1_2_3_Seasons + Task_1_2_3_Seasons + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/App.config b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Program.cs new file mode 100644 index 0000000..cbd4878 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_4_GoodOrBad +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите 1 или 0:"); + int number = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine(number == 1 ? "Хорошо" : "Плохо"); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..52f1740 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_4_GoodOrBad")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_4_GoodOrBad")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1ad1fd77-be65-4406-b18d-c58ac5c3d92c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Task_1_2_4_GoodOrBad.csproj b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Task_1_2_4_GoodOrBad.csproj new file mode 100644 index 0000000..a53e8ae --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_4_GoodOrBad/Task_1_2_4_GoodOrBad.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {1AD1FD77-BE65-4406-B18D-C58AC5C3D92C} + Exe + Properties + Task_1_2_4_GoodOrBad + Task_1_2_4_GoodOrBad + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/App.config b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Program.cs new file mode 100644 index 0000000..04239ea --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Program.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_5_DayOfWeek +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите номер дня недели:"); + int number = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine(GetDayOfWeekByNumber(number)); + Console.ReadLine(); + } + + static string GetDayOfWeekByNumber(int number) + { + string result = string.Empty; + switch (number) + { + case 1: result = "Понедельник";break; + case 2: result = "Вторник"; break; + case 3: result = "Среда"; break; + case 4: result = "Четверг"; break; + case 5: result = "Пятница"; break; + case 6: result = "Суббота"; break; + case 7: result = "Воскресенье"; break; + default: result = "Такого дня недели на этой планете нет."; + break; + } + + return result; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c609f81 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_5_DayOfWeek")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_5_DayOfWeek")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("603eee51-5ad4-4e72-a72e-ab8e61513a00")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Task_1_2_5_DayOfWeek.csproj b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Task_1_2_5_DayOfWeek.csproj new file mode 100644 index 0000000..74f6aa6 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_5_DayOfWeek/Task_1_2_5_DayOfWeek.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {603EEE51-5AD4-4E72-A72E-AB8E61513A00} + Exe + Properties + Task_1_2_5_DayOfWeek + Task_1_2_5_DayOfWeek + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/App.config b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Program.cs new file mode 100644 index 0000000..3421f81 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Program.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_6_Taxi +{ + class Program + { + static void Main(string[] args) + { + Console.Write("Введите рассояние которое вы проехали(в киллометрах): "); + double distance = Convert.ToDouble(Console.ReadLine()); + + Console.Write("Введите количество минут простоя: "); + int waitTime = Convert.ToInt32(Console.ReadLine()); + + double fare = Payment(distance, new TimeSpan(0, waitTime, 0)); + + Console.WriteLine("Стоимость проезда составляет: {0} грн.", fare); + + Console.ReadLine(); + } + + static double Payment(double distance, TimeSpan waitTime) + { + double payment = 20; + + if(distance > 5) + { + payment += (distance - 5) * 3; + } + + payment += waitTime.TotalMinutes; + + return payment; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c30b14e --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_6_Taxi")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_6_Taxi")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("687c93a2-a6d0-4955-a57c-afee247ccaa8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Task_1_2_6_Taxi.csproj b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Task_1_2_6_Taxi.csproj new file mode 100644 index 0000000..be51819 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_6_Taxi/Task_1_2_6_Taxi.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {687C93A2-A6D0-4955-A57C-AFEE247CCAA8} + Exe + Properties + Task_1_2_6_Taxi + Task_1_2_6_Taxi + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/App.config b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Program.cs new file mode 100644 index 0000000..5be5752 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Program.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_7_SimpleNumber +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите натуральное число:"); + int number = Convert.ToInt32(Console.ReadLine()); + if (IsSimple(number)) + { + Console.WriteLine("Число {0} - является простым.", number); + } + else + { + Console.WriteLine("Число {0} - не является простым.", number); + } + Console.ReadLine(); + } + + static bool IsSimple(int number) + { + int numberOfDivisors = 0; + + for (int i = 1; i <= number; i++) + { + if(number % i == 0) + { + numberOfDivisors++; + } + } + + return numberOfDivisors == 2; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9bb4628 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_7_SimpleNumber")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_7_SimpleNumber")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b98dbbad-606b-43d2-bbb3-1afdbd62aea7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Task_1_2_7_SimpleNumber.csproj b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Task_1_2_7_SimpleNumber.csproj new file mode 100644 index 0000000..82161c7 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_7_SimpleNumber/Task_1_2_7_SimpleNumber.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {B98DBBAD-606B-43D2-BBB3-1AFDBD62AEA7} + Exe + Properties + Task_1_2_7_SimpleNumber + Task_1_2_7_SimpleNumber + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/App.config b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Program.cs new file mode 100644 index 0000000..f3887e6 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Program.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_8_Lottery +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Сделайте вашу ставку: "); + double rate = Convert.ToDouble(Console.ReadLine()); + Console.WriteLine("Вы выиграли {0} грн.", CalculateWinnings(rate)); + + Console.ReadLine(); + } + + static double CalculateWinnings(double rate) + { + double winning = 0; + int result = ThrowDice(12); + + if (result >= 6 && result <= 8) + { + winning = rate; + } + else if(result >= 9 && result <= 11) + { + winning = rate * 2; + } + else if(result == 12) + { + winning = rate * 10; + } + + + return winning; + } + + + static Random random = new Random((int)DateTime.Now.Ticks); + + static int ThrowDice(int numberOfSides) + { + return random.Next(1, numberOfSides + 1); + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7ec5b5d --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_8_Lottery")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_8_Lottery")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("eca16ee3-cc9d-47e0-baa8-f4201e74b8b1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Task_1_2_8_Lottery.csproj b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Task_1_2_8_Lottery.csproj new file mode 100644 index 0000000..ea981db --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_8_Lottery/Task_1_2_8_Lottery.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {ECA16EE3-CC9D-47E0-BAA8-F4201E74B8B1} + Exe + Properties + Task_1_2_8_Lottery + Task_1_2_8_Lottery + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/App.config b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currencies.cs b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currencies.cs new file mode 100644 index 0000000..957c9d5 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currencies.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_9_CurrencyConverter +{ + public enum Currencies + { + UAH, + EUR, + USD + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currency.cs b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currency.cs new file mode 100644 index 0000000..33bbacc --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Currency.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_9_CurrencyConverter +{ + class Currency + { + public double Rate { get; set; } + + public Currencies From { get; set; } + + public Currencies To { get; set; } + + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/CurrencyConverter.cs b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/CurrencyConverter.cs new file mode 100644 index 0000000..39e5e4b --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/CurrencyConverter.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_9_CurrencyConverter +{ + static class CurrencyConverter + { + private static List currencies = new List(); + + static CurrencyConverter() + { + currencies.Add(new Currency() + { + From = Currencies.UAH, + To = Currencies.USD, + Rate = 0.038767 + }); + + currencies.Add(new Currency() + { + From = Currencies.USD, + To = Currencies.UAH, + Rate = 25.795135 + }); + + currencies.Add(new Currency() + { + From = Currencies.UAH, + To = Currencies.EUR, + Rate = 0.035161855 + }); + + currencies.Add(new Currency() + { + From = Currencies.EUR, + To = Currencies.UAH, + Rate = 28.4399102 + }); + + currencies.Add(new Currency() + { + From = Currencies.EUR, + To = Currencies.USD, + Rate = 1.10253 + }); + + currencies.Add(new Currency() + { + From = Currencies.USD, + To = Currencies.EUR, + Rate = 0.907004798 + }); + } + + public static double Convert(double amount, Currencies from, Currencies to) + { + Currency currency = currencies.Where(cur => cur.From == from && cur.To == to).First(); + return amount * currency.Rate; + } + + + + + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Program.cs b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Program.cs new file mode 100644 index 0000000..9531cd2 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Program.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_2_9_CurrencyConverter +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Выберите валюту, которую хотите перевести: UAH, EUR, USD"); + string selectedCurrency = Console.ReadLine().ToUpper(); + Console.WriteLine("Введите необходимую сумму:"); + double amount = Convert.ToDouble(Console.ReadLine()); + + if (selectedCurrency.Equals("UAH")) + { + Console.WriteLine("{0} UAH = {1} USD", amount, CurrencyConverter.Convert(amount, Currencies.UAH, Currencies.USD)); + Console.WriteLine("{0} UAH = {1} EUR", amount, CurrencyConverter.Convert(amount, Currencies.UAH, Currencies.EUR)); + } + else if (selectedCurrency.Equals("USD")) + { + Console.WriteLine("{0} USD = {1} UAH", amount, CurrencyConverter.Convert(amount, Currencies.USD, Currencies.UAH)); + Console.WriteLine("{0} USD = {1} EUR", amount, CurrencyConverter.Convert(amount, Currencies.USD, Currencies.EUR)); + } + else if (selectedCurrency.Equals("EUR")) + { + Console.WriteLine("{0} EUR = {1} UAH", amount, CurrencyConverter.Convert(amount, Currencies.EUR, Currencies.UAH)); + Console.WriteLine("{0} EUR = {1} USD", amount, CurrencyConverter.Convert(amount, Currencies.EUR, Currencies.USD)); + } + + Console.ReadLine(); + } + + + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3d08aae --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_2_9_CurrencyConverter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_2_9_CurrencyConverter")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("22d2a9e4-fc41-4d1b-98a2-718568470619")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Task_1_2_9_CurrencyConverter.csproj b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Task_1_2_9_CurrencyConverter.csproj new file mode 100644 index 0000000..6b6db23 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_2_9_CurrencyConverter/Task_1_2_9_CurrencyConverter.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {22D2A9E4-FC41-4D1B-98A2-718568470619} + Exe + Properties + Task_1_2_9_CurrencyConverter + Task_1_2_9_CurrencyConverter + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/App.config b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Program.cs new file mode 100644 index 0000000..02c0e04 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_1_MultiplicationTable +{ + class Program + { + static void Main(string[] args) + { + Console.Write("Введите число для умножения: "); + int multiplier = Convert.ToInt32(Console.ReadLine()); + DisplayMultiplicationTable(multiplier); + Console.ReadLine(); + } + + static void DisplayMultiplicationTable(int multiplier) + { + for (int i = 1; i <= 20; i++) + { + Console.WriteLine("{0} x {1} = {2}", multiplier, i, multiplier * i); + } + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9a00b25 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_1_MultiplicationTable")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_1_MultiplicationTable")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("46c002f7-54db-4475-bf2d-fa061928794f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Task_1_3_1_MultiplicationTable.csproj b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Task_1_3_1_MultiplicationTable.csproj new file mode 100644 index 0000000..44a61e9 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_1_MultiplicationTable/Task_1_3_1_MultiplicationTable.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {46C002F7-54DB-4475-BF2D-FA061928794F} + Exe + Properties + Task_1_3_1_MultiplicationTable + Task_1_3_1_MultiplicationTable + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/App.config b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Program.cs new file mode 100644 index 0000000..22fc3a4 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_2_NumberRange +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите число: "); + int number = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Количество разрядов числа {0}: {1}", number, GetRange(number)); + Console.ReadLine(); + } + + static int GetRange(int number) + { + number = Math.Abs(number); + int range = (number == 0) ? 1 : 0; + while (number > 0) + { + number = number / 10; + range++; + } + + return range; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7ad5f38 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_2_NumberRange")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_2_NumberRange")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("363ad540-0f02-44e7-9495-38a73fb38169")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Task_1_3_2_NumberRange.csproj b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Task_1_3_2_NumberRange.csproj new file mode 100644 index 0000000..600f85b --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_2_NumberRange/Task_1_3_2_NumberRange.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {363AD540-0F02-44E7-9495-38A73FB38169} + Exe + Properties + Task_1_3_2_NumberRange + Task_1_3_2_NumberRange + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/App.config b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Program.cs new file mode 100644 index 0000000..46f768e --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Program.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_3_GuessTheNumber +{ + class Program + { + static void Main(string[] args) + { + int unknownNumber = GenerateRandomNumber(1, 146); + Console.WriteLine(unknownNumber); + int number; + do + { + Console.Write("Угадайте число от 1 до 146: "); + number = Convert.ToInt32(Console.ReadLine()); + if(number != unknownNumber) + { + if(unknownNumber > number) + { + Console.WriteLine("Больше!!!"); + } + else + { + Console.WriteLine("Меньше!!!"); + } + } + + } while (number != unknownNumber); + + Console.WriteLine("Поздравляю, Вы угадали"); + + Console.ReadLine(); + } + + static int GenerateRandomNumber(int min, int max) + { + Random random = new Random((int)DateTime.Now.Ticks); + return random.Next(min, max + 1); + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cdae6b9 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_3_GuessTheNumber")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_3_GuessTheNumber")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fba9dfb0-0b54-4afc-bbc8-9150b165f33a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Task_1_3_3_GuessTheNumber.csproj b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Task_1_3_3_GuessTheNumber.csproj new file mode 100644 index 0000000..f47446b --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_3_GuessTheNumber/Task_1_3_3_GuessTheNumber.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {FBA9DFB0-0B54-4AFC-BBC8-9150B165F33A} + Exe + Properties + Task_1_3_3_GuessTheNumber + Task_1_3_3_GuessTheNumber + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/App.config b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Program.cs new file mode 100644 index 0000000..7f32e9d --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_4_SquareNumber +{ + class Program + { + static void Main(string[] args) + { + Console.Write("Введите число: "); + int number = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Квадраты натуральных чисел, которые меньше числа {0}:", number); + foreach (int square in GetSquares(number)) + { + Console.WriteLine(square); + } + + Console.ReadLine(); + } + + static IEnumerable GetSquares(int number) + { + List squares = new List(); + + for (int i = 1; i < Math.Sqrt(number); i++) + { + int square = (int)Math.Pow(i, 2); + squares.Add(square); + } + + return squares; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..eddccc4 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_4_SquareNumber")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_4_SquareNumber")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("349127de-8616-4ab8-8225-4c92261e331c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Task_1_3_4_SquareNumber.csproj b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Task_1_3_4_SquareNumber.csproj new file mode 100644 index 0000000..15679d4 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_4_SquareNumber/Task_1_3_4_SquareNumber.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {349127DE-8616-4AB8-8225-4C92261E331C} + Exe + Properties + Task_1_3_4_SquareNumber + Task_1_3_4_SquareNumber + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_5_Average/App.config b/PisotskiyPavel/Task_1/Task_1_3_5_Average/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_5_Average/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_5_Average/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_5_Average/Program.cs new file mode 100644 index 0000000..f37068d --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_5_Average/Program.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_5_Average +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Введите 5 любых чисел:"); + double[] numbers = new double[5]; + for (int i = 0; i < numbers.Length; i++) + { + Console.Write("Введите число №{0}: ", i + 1); + numbers[i] = Convert.ToDouble(Console.ReadLine()); + } + + Console.WriteLine("Среднее арифметическое этих чисел: {0}", Average(numbers)); + + Console.ReadLine(); + } + + static double Average(ICollection numbers) + { + double sum = 0; + foreach (double number in numbers) + { + checked + { + sum += number; + } + } + + return sum / numbers.Count; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_5_Average/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_5_Average/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..eb90fc3 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_5_Average/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_5_Average")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_5_Average")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b9876e71-4674-47a2-9d35-590a1a9c6de9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_5_Average/Task_1_3_5_Average.csproj b/PisotskiyPavel/Task_1/Task_1_3_5_Average/Task_1_3_5_Average.csproj new file mode 100644 index 0000000..65fbbf4 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_5_Average/Task_1_3_5_Average.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {B9876E71-4674-47A2-9D35-590A1A9C6DE9} + Exe + Properties + Task_1_3_5_Average + Task_1_3_5_Average + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/App.config b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Program.cs new file mode 100644 index 0000000..015280c --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Program.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_6_AverageOfRandomNumbers +{ + class Program + { + static Random random = new Random((int)DateTime.Now.Ticks); + + static void Main(string[] args) + { + Console.WriteLine("Числа:"); + double[] numbers = new double[5]; + for (int i = 0; i < numbers.Length; i++) + { + numbers[i] = random.Next(); + Console.WriteLine(numbers[i]); + } + + Console.WriteLine("Среднее арифметическое этих чисел: {0}", Average(numbers)); + + Console.ReadLine(); + } + + static double Average(ICollection numbers) + { + double sum = 0; + foreach (double number in numbers) + { + checked + { + sum += number; + } + } + + return sum / numbers.Count; + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..529f17a --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_6_AverageOfRandomNumbers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_6_AverageOfRandomNumbers")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("91482b71-5dec-4534-9b88-3c9a1becc673")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Task_1_3_6_AverageOfRandomNumbers.csproj b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Task_1_3_6_AverageOfRandomNumbers.csproj new file mode 100644 index 0000000..07c6efc --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_6_AverageOfRandomNumbers/Task_1_3_6_AverageOfRandomNumbers.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {91482B71-5DEC-4534-9B88-3C9A1BECC673} + Exe + Properties + Task_1_3_6_AverageOfRandomNumbers + Task_1_3_6_AverageOfRandomNumbers + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/App.config b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Program.cs new file mode 100644 index 0000000..467dd1e --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_7_GeeseAndRabbits +{ + class Program + { + static void Main(string[] args) + { + int legs = 64; + for (int i = 0; i <= legs; i += 2) + { + if((legs - i) % 4 == 0) + { + int geese = i / 2; + int rabbits = (legs - i) / 4; + Console.WriteLine("Гусей: {0},а кроликов: {1}", geese, rabbits); + } + } + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f287a10 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_7_GeeseAndRabbits")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_7_GeeseAndRabbits")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5f7aac98-97ac-48f2-a5b4-e8d5fc4b454f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Task_1_3_7_GeeseAndRabbits.csproj b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Task_1_3_7_GeeseAndRabbits.csproj new file mode 100644 index 0000000..4161091 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_7_GeeseAndRabbits/Task_1_3_7_GeeseAndRabbits.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {5F7AAC98-97AC-48F2-A5B4-E8D5FC4B454F} + Exe + Properties + Task_1_3_7_GeeseAndRabbits + Task_1_3_7_GeeseAndRabbits + v4.5.2 + 512 + 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/PisotskiyPavel/Task_1/Task_1_3_8_Password/App.config b/PisotskiyPavel/Task_1/Task_1_3_8_Password/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_8_Password/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_1/Task_1_3_8_Password/Program.cs b/PisotskiyPavel/Task_1/Task_1_3_8_Password/Program.cs new file mode 100644 index 0000000..f3d1e94 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_8_Password/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1_3_8_Password +{ + class Program + { + static void Main(string[] args) + { + string correctPassword = "root"; + string password = string.Empty; + + do + { + Console.Write("Введите пароль: "); + password = Console.ReadLine(); + Console.Clear(); + if (!correctPassword.Equals(password)) + { + Console.WriteLine("Неверный пароль!"); + } + } while (!correctPassword.Equals(password)); + + Console.WriteLine("Вы успешно ввели пароль."); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_1/Task_1_3_8_Password/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_1/Task_1_3_8_Password/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..dcbcb45 --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_8_Password/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_1_3_8_Password")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_1_3_8_Password")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f58da110-c529-48f4-8768-4ecdc47242e5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_1/Task_1_3_8_Password/Task_1_3_8_Password.csproj b/PisotskiyPavel/Task_1/Task_1_3_8_Password/Task_1_3_8_Password.csproj new file mode 100644 index 0000000..aadc26b --- /dev/null +++ b/PisotskiyPavel/Task_1/Task_1_3_8_Password/Task_1_3_8_Password.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {F58DA110-C529-48F4-8768-4ECDC47242E5} + Exe + Properties + Task_1_3_8_Password + Task_1_3_8_Password + v4.5.2 + 512 + 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 From 8c04e48b40eccb78bcb70dae2acce9af7c5de5b6 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Wed, 19 Oct 2016 11:43:52 +0300 Subject: [PATCH 02/12] Task 2 is done --- PisotskiyPavel/Task_2/Task_2.sln | 64 +++++++ PisotskiyPavel/Task_2/Task_2_1/Address.cs | 39 +++++ PisotskiyPavel/Task_2/Task_2_1/App.config | 6 + PisotskiyPavel/Task_2/Task_2_1/Program.cs | 28 ++++ .../Task_2_1/Properties/AssemblyInfo.cs | 36 ++++ .../Task_2/Task_2_1/Task_2_1.csproj | 61 +++++++ PisotskiyPavel/Task_2/Task_2_2/App.config | 6 + PisotskiyPavel/Task_2/Task_2_2/Program.cs | 26 +++ .../Task_2_2/Properties/AssemblyInfo.cs | 36 ++++ PisotskiyPavel/Task_2/Task_2_2/Rectangle.cs | 45 +++++ .../Task_2/Task_2_2/Task_2_2.csproj | 61 +++++++ PisotskiyPavel/Task_2/Task_2_3/App.config | 6 + PisotskiyPavel/Task_2/Task_2_3/Author.cs | 26 +++ PisotskiyPavel/Task_2/Task_2_3/Book.cs | 23 +++ PisotskiyPavel/Task_2/Task_2_3/Content.cs | 26 +++ PisotskiyPavel/Task_2/Task_2_3/Program.cs | 24 +++ .../Task_2_3/Properties/AssemblyInfo.cs | 36 ++++ .../Task_2/Task_2_3/Task_2_3.csproj | 64 +++++++ PisotskiyPavel/Task_2/Task_2_3/Title.cs | 26 +++ PisotskiyPavel/Task_2/Task_2_4/App.config | 6 + PisotskiyPavel/Task_2/Task_2_4/Figure.cs | 63 +++++++ PisotskiyPavel/Task_2/Task_2_4/Point.cs | 25 +++ PisotskiyPavel/Task_2/Task_2_4/Program.cs | 19 +++ .../Task_2_4/Properties/AssemblyInfo.cs | 36 ++++ .../Task_2/Task_2_4/Task_2_4.csproj | 62 +++++++ PisotskiyPavel/Task_2/Task_2_5/App.config | 6 + PisotskiyPavel/Task_2/Task_2_5/Program.cs | 24 +++ .../Task_2_5/Properties/AssemblyInfo.cs | 36 ++++ .../Task_2/Task_2_5/Task_2_5.csproj | 61 +++++++ PisotskiyPavel/Task_2/Task_2_5/User.cs | 26 +++ PisotskiyPavel/Task_2/Task_2_6/App.config | 6 + PisotskiyPavel/Task_2/Task_2_6/Converter.cs | 156 ++++++++++++++++++ PisotskiyPavel/Task_2/Task_2_6/Currencies.cs | 16 ++ PisotskiyPavel/Task_2/Task_2_6/Currency.cs | 17 ++ PisotskiyPavel/Task_2/Task_2_6/Program.cs | 32 ++++ .../Task_2_6/Properties/AssemblyInfo.cs | 36 ++++ .../Task_2/Task_2_6/Task_2_6.csproj | 63 +++++++ PisotskiyPavel/Task_2/Task_2_7/App.config | 6 + PisotskiyPavel/Task_2/Task_2_7/Employee.cs | 35 ++++ .../Task_2/Task_2_7/EmployeePosition.cs | 15 ++ PisotskiyPavel/Task_2/Task_2_7/Program.cs | 72 ++++++++ .../Task_2_7/Properties/AssemblyInfo.cs | 36 ++++ .../Task_2/Task_2_7/Task_2_7.csproj | 62 +++++++ PisotskiyPavel/Task_2/Task_2_8/App.config | 6 + PisotskiyPavel/Task_2/Task_2_8/Invoice.cs | 51 ++++++ PisotskiyPavel/Task_2/Task_2_8/Program.cs | 27 +++ .../Task_2_8/Properties/AssemblyInfo.cs | 36 ++++ .../Task_2/Task_2_8/Task_2_8.csproj | 61 +++++++ 48 files changed, 1736 insertions(+) create mode 100644 PisotskiyPavel/Task_2/Task_2.sln create mode 100644 PisotskiyPavel/Task_2/Task_2_1/Address.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_1/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_1/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_1/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_1/Task_2_1.csproj create mode 100644 PisotskiyPavel/Task_2/Task_2_2/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_2/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_2/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_2/Rectangle.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_2/Task_2_2.csproj create mode 100644 PisotskiyPavel/Task_2/Task_2_3/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_3/Author.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_3/Book.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_3/Content.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_3/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_3/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_3/Task_2_3.csproj create mode 100644 PisotskiyPavel/Task_2/Task_2_3/Title.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_4/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_4/Figure.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_4/Point.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_4/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_4/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_4/Task_2_4.csproj create mode 100644 PisotskiyPavel/Task_2/Task_2_5/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_5/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_5/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_5/Task_2_5.csproj create mode 100644 PisotskiyPavel/Task_2/Task_2_5/User.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_6/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_6/Converter.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_6/Currencies.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_6/Currency.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_6/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_6/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_6/Task_2_6.csproj create mode 100644 PisotskiyPavel/Task_2/Task_2_7/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_7/Employee.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_7/EmployeePosition.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_7/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_7/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_7/Task_2_7.csproj create mode 100644 PisotskiyPavel/Task_2/Task_2_8/App.config create mode 100644 PisotskiyPavel/Task_2/Task_2_8/Invoice.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_8/Program.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_8/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_2/Task_2_8/Task_2_8.csproj diff --git a/PisotskiyPavel/Task_2/Task_2.sln b/PisotskiyPavel/Task_2/Task_2.sln new file mode 100644 index 0000000..380d803 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2.sln @@ -0,0 +1,64 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_1", "Task_2_1\Task_2_1.csproj", "{1DB75B58-AF3E-414A-9A0E-8B6AAD265432}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_2", "Task_2_2\Task_2_2.csproj", "{B0C68B79-3361-42F9-A393-03379676B9E3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_3", "Task_2_3\Task_2_3.csproj", "{1B917FFB-6653-4E8B-81D8-93D6B54F7209}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_4", "Task_2_4\Task_2_4.csproj", "{7B061099-58CF-4FBA-92C3-919B3C4B3C20}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_5", "Task_2_5\Task_2_5.csproj", "{9F1E9D29-B422-4EC9-B2FE-4E75D40E19D0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_6", "Task_2_6\Task_2_6.csproj", "{C7D70715-7B79-423A-92A7-E1AF7AAB2074}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_7", "Task_2_7\Task_2_7.csproj", "{EA4D918B-30F5-4F23-9FB9-AF495EFA0C5C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_2_8", "Task_2_8\Task_2_8.csproj", "{9741C7A3-32A1-43CF-81C1-63F482F1FA51}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1DB75B58-AF3E-414A-9A0E-8B6AAD265432}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DB75B58-AF3E-414A-9A0E-8B6AAD265432}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DB75B58-AF3E-414A-9A0E-8B6AAD265432}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DB75B58-AF3E-414A-9A0E-8B6AAD265432}.Release|Any CPU.Build.0 = Release|Any CPU + {B0C68B79-3361-42F9-A393-03379676B9E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C68B79-3361-42F9-A393-03379676B9E3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C68B79-3361-42F9-A393-03379676B9E3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C68B79-3361-42F9-A393-03379676B9E3}.Release|Any CPU.Build.0 = Release|Any CPU + {1B917FFB-6653-4E8B-81D8-93D6B54F7209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B917FFB-6653-4E8B-81D8-93D6B54F7209}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B917FFB-6653-4E8B-81D8-93D6B54F7209}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B917FFB-6653-4E8B-81D8-93D6B54F7209}.Release|Any CPU.Build.0 = Release|Any CPU + {7B061099-58CF-4FBA-92C3-919B3C4B3C20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B061099-58CF-4FBA-92C3-919B3C4B3C20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B061099-58CF-4FBA-92C3-919B3C4B3C20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B061099-58CF-4FBA-92C3-919B3C4B3C20}.Release|Any CPU.Build.0 = Release|Any CPU + {9F1E9D29-B422-4EC9-B2FE-4E75D40E19D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F1E9D29-B422-4EC9-B2FE-4E75D40E19D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F1E9D29-B422-4EC9-B2FE-4E75D40E19D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F1E9D29-B422-4EC9-B2FE-4E75D40E19D0}.Release|Any CPU.Build.0 = Release|Any CPU + {C7D70715-7B79-423A-92A7-E1AF7AAB2074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7D70715-7B79-423A-92A7-E1AF7AAB2074}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7D70715-7B79-423A-92A7-E1AF7AAB2074}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7D70715-7B79-423A-92A7-E1AF7AAB2074}.Release|Any CPU.Build.0 = Release|Any CPU + {EA4D918B-30F5-4F23-9FB9-AF495EFA0C5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA4D918B-30F5-4F23-9FB9-AF495EFA0C5C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA4D918B-30F5-4F23-9FB9-AF495EFA0C5C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA4D918B-30F5-4F23-9FB9-AF495EFA0C5C}.Release|Any CPU.Build.0 = Release|Any CPU + {9741C7A3-32A1-43CF-81C1-63F482F1FA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9741C7A3-32A1-43CF-81C1-63F482F1FA51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9741C7A3-32A1-43CF-81C1-63F482F1FA51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9741C7A3-32A1-43CF-81C1-63F482F1FA51}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PisotskiyPavel/Task_2/Task_2_1/Address.cs b/PisotskiyPavel/Task_2/Task_2_1/Address.cs new file mode 100644 index 0000000..d133498 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_1/Address.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_1 +{ + class Address + { + public int Index { get; set; } + public string Country { get; set; } + public string City { get; set; } + public string Street { get; set; } + public int House { get; set; } + public int Apartment { get; set; } + + public Address() + { + + } + + public Address(int index, string country, string city, string street, int house, int apartment) + { + Index = index; + Country = country; + City = city; + Street = street; + House = house; + Apartment = apartment; + } + + public override string ToString() + { + return string.Format("Индекс: {1}{0}Страна: {2}{0}Город: {3}{0}Улица: {4}{0}Дом: {5}{0}Квартира: {6}", Environment.NewLine, + Index, Country, City, Street, House, Apartment); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_1/App.config b/PisotskiyPavel/Task_2/Task_2_1/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_1/Program.cs b/PisotskiyPavel/Task_2/Task_2_1/Program.cs new file mode 100644 index 0000000..58f22e4 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_1/Program.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_1 +{ + class Program + { + static void Main(string[] args) + { + Address address = new Address() + { + Index = 49044, + Country = "Украина", + City = "Днепр", + Street = "ул. Шевченко", + House = 14, + Apartment = 202 + }; + + Console.WriteLine(address.ToString()); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_1/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3a577a7 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_1")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1db75b58-af3e-414a-9a0e-8b6aad265432")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_1/Task_2_1.csproj b/PisotskiyPavel/Task_2/Task_2_1/Task_2_1.csproj new file mode 100644 index 0000000..862ad69 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_1/Task_2_1.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {1DB75B58-AF3E-414A-9A0E-8B6AAD265432} + Exe + Properties + Task_2_1 + Task_2_1 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_2/Task_2_2/App.config b/PisotskiyPavel/Task_2/Task_2_2/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_2/Program.cs b/PisotskiyPavel/Task_2/Task_2_2/Program.cs new file mode 100644 index 0000000..0888d2b --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_2/Program.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_2 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Чтобы посчитать площадь и периметр прямоугольника введите:"); + Console.Write("Длину стороны №1: "); + double side1 = Convert.ToDouble(Console.ReadLine()); + Console.Write("Длину стороны №2: "); + double side2 = Convert.ToDouble(Console.ReadLine()); + + Rectangle rect = new Rectangle(side1, side2); + Console.WriteLine("Площадь прямоугольника: {0}", rect.Area); + Console.WriteLine("Периметр прямоугольника: {0}", rect.Perimeter); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_2/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..35777ed --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_2")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b0c68b79-3361-42f9-a393-03379676b9e3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_2/Rectangle.cs b/PisotskiyPavel/Task_2/Task_2_2/Rectangle.cs new file mode 100644 index 0000000..bbe845c --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_2/Rectangle.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_2 +{ + class Rectangle + { + private readonly double side1, side2; + + public Rectangle(double side1, double side2) + { + this.side1 = side1; + this.side2 = side2; + } + + public double Area + { + get + { + return AreaCalculator(); + } + } + + public double Perimeter + { + get + { + return PerimeterCalculator(); + } + } + + private double AreaCalculator() + { + return side1 * side2; + } + + private double PerimeterCalculator() + { + return 2 * (side1 + side2); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_2/Task_2_2.csproj b/PisotskiyPavel/Task_2/Task_2_2/Task_2_2.csproj new file mode 100644 index 0000000..d2fe63e --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_2/Task_2_2.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {B0C68B79-3361-42F9-A393-03379676B9E3} + Exe + Properties + Task_2_2 + Task_2_2 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_2/Task_2_3/App.config b/PisotskiyPavel/Task_2/Task_2_3/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_3/Author.cs b/PisotskiyPavel/Task_2/Task_2_3/Author.cs new file mode 100644 index 0000000..4f5ea81 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/Author.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_3 +{ + class Author + { + private string author; + + public Author(string author) + { + this.author = author; + } + + public void Show() + { + ConsoleColor oldColor = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Cyan; + Console.WriteLine(author); + Console.ForegroundColor = oldColor; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_3/Book.cs b/PisotskiyPavel/Task_2/Task_2_3/Book.cs new file mode 100644 index 0000000..79610c0 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/Book.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_3 +{ + class Book + { + public Author Author { get; set; } + public Title Title { get; set; } + public Content Content { get; set; } + + public void Show() + { + Author.Show(); + Title.Show(); + Content.Show(); + } + + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_3/Content.cs b/PisotskiyPavel/Task_2/Task_2_3/Content.cs new file mode 100644 index 0000000..e5f3630 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/Content.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_3 +{ + class Content + { + private string content; + + public Content(string content) + { + this.content = content; + } + + public void Show() + { + ConsoleColor oldColor = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine(content); + Console.ForegroundColor = oldColor; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_3/Program.cs b/PisotskiyPavel/Task_2/Task_2_3/Program.cs new file mode 100644 index 0000000..99685fb --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_3 +{ + class Program + { + static void Main(string[] args) + { + Book book = new Book() + { + Author = new Author("Jeffrey Richter"), + Title = new Title("CLR via C#"), + Content = new Content("CLR via C#. Программирование на платформе Microsoft.NET Framework 4.5 на языке C#") + }; + book.Show(); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_3/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..22d9b5d --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_3")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_3")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1b917ffb-6653-4e8b-81d8-93d6b54f7209")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_3/Task_2_3.csproj b/PisotskiyPavel/Task_2/Task_2_3/Task_2_3.csproj new file mode 100644 index 0000000..59d58e3 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/Task_2_3.csproj @@ -0,0 +1,64 @@ + + + + + Debug + AnyCPU + {1B917FFB-6653-4E8B-81D8-93D6B54F7209} + Exe + Properties + Task_2_3 + Task_2_3 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_2/Task_2_3/Title.cs b/PisotskiyPavel/Task_2/Task_2_3/Title.cs new file mode 100644 index 0000000..91121e7 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_3/Title.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_3 +{ + class Title + { + private string title; + + public Title(string title) + { + this.title = title; + } + + public void Show() + { + ConsoleColor oldColor = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine(title); + Console.ForegroundColor = oldColor; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_4/App.config b/PisotskiyPavel/Task_2/Task_2_4/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_4/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_4/Figure.cs b/PisotskiyPavel/Task_2/Task_2_4/Figure.cs new file mode 100644 index 0000000..5c12a29 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_4/Figure.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_4 +{ + class Figure + { + private readonly Point[] points; + + public Figure(Point p1, Point p2, Point p3) + { + points = new Point[3] { p1, p2, p3 }; + } + + public Figure(Point p1, Point p2, Point p3, Point p4) + { + points = new Point[4] { p1, p2, p3, p4 }; + } + + public Figure(Point p1, Point p2, Point p3, Point p4, Point p5) + { + points = new Point[5] { p1, p2, p3, p4, p5 }; + } + + public double LenghtSide(Point a, Point b) + { + return Math.Sqrt(Math.Pow(b.X - a.X, 2) + Math.Pow(b.Y - a.Y, 2)); + } + + public double Perimeter { get { return PerimeterCalculator(); } } + + public string Name + { + get + { + string name = string.Empty; + + foreach (Point point in points) + { + name += point.Name; + } + + return name; + } + } + + private double PerimeterCalculator() + { + double perimeter = 0; + for (int i = 0; i < points.Length - 1; i++) + { + perimeter += LenghtSide(points[i], points[i + 1]); + } + + perimeter += LenghtSide(points[points.Length - 1], points[0]); + + return perimeter; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_4/Point.cs b/PisotskiyPavel/Task_2/Task_2_4/Point.cs new file mode 100644 index 0000000..a6eae2e --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_4/Point.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_4 +{ + class Point + { + private int x, y; + private string name; + + public int X { get { return x; } } + public int Y { get { return y; } } + public string Name { get { return name; } } + + public Point(int x, int y, string name) + { + this.x = x; + this.y = y; + this.name = name; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_4/Program.cs b/PisotskiyPavel/Task_2/Task_2_4/Program.cs new file mode 100644 index 0000000..fbe4b15 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_4/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_4 +{ + class Program + { + static void Main(string[] args) + { + Figure figure = new Figure(new Point(2, 2, "A"), new Point(-4, -2, "B"), new Point(4, -2, "C"), new Point(4, 2, "D")); + Console.WriteLine("Периметр многоугольника {0}: {1}", figure.Name, figure.Perimeter); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_4/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f968773 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_4")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("7b061099-58cf-4fba-92c3-919b3c4b3c20")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_4/Task_2_4.csproj b/PisotskiyPavel/Task_2/Task_2_4/Task_2_4.csproj new file mode 100644 index 0000000..02ebb45 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_4/Task_2_4.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {7B061099-58CF-4FBA-92C3-919B3C4B3C20} + Exe + Properties + Task_2_4 + Task_2_4 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_2/Task_2_5/App.config b/PisotskiyPavel/Task_2/Task_2_5/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_5/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_5/Program.cs b/PisotskiyPavel/Task_2/Task_2_5/Program.cs new file mode 100644 index 0000000..1b5d388 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_5/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_5 +{ + class Program + { + static void Main(string[] args) + { + User user = new User("PisotskiyPavel", "Pavel", "Pisotskiy", 22); + + Console.WriteLine("Логин: {0}", user.Login); + Console.WriteLine("Имя: {0}", user.FirstName); + Console.WriteLine("Фамилия: {0}", user.SecondName); + Console.WriteLine("Возраст: {0}", user.Age); + Console.WriteLine("Дата заполнения анкеты: {0}", user.RegistrationDate.ToLocalTime()); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_5/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_5/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..22a5d66 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_5/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_5")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_5")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9f1e9d29-b422-4ec9-b2fe-4e75d40e19d0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_5/Task_2_5.csproj b/PisotskiyPavel/Task_2/Task_2_5/Task_2_5.csproj new file mode 100644 index 0000000..04307eb --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_5/Task_2_5.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {9F1E9D29-B422-4EC9-B2FE-4E75D40E19D0} + Exe + Properties + Task_2_5 + Task_2_5 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_2/Task_2_5/User.cs b/PisotskiyPavel/Task_2/Task_2_5/User.cs new file mode 100644 index 0000000..58cc060 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_5/User.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_5 +{ + class User + { + public string Login { get; set; } + public string FirstName { get; set; } + public string SecondName { get; set; } + public int Age { get; set; } + public DateTime RegistrationDate { get; protected set; } + + public User(string login, string firstName, string secondName, int age) + { + Login = login; + FirstName = firstName; + SecondName = secondName; + Age = age; + RegistrationDate = DateTime.UtcNow; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_6/App.config b/PisotskiyPavel/Task_2/Task_2_6/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_6/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_6/Converter.cs b/PisotskiyPavel/Task_2/Task_2_6/Converter.cs new file mode 100644 index 0000000..6b8420f --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_6/Converter.cs @@ -0,0 +1,156 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_6 +{ + class Converter + { + private readonly double usd, eur, rub; + private readonly List currencies = new List(); + + + /// + /// Initializes a new instance of the class Converter, which is used for currency conversion + /// + /// Value of 1 USD in UAH + /// Value of 1 EUR in UAH + /// Value of 1 RUB in UAH + public Converter(double usd, double eur, double rub) + { + this.usd = usd; + this.eur = eur; + this.rub = rub; + + CurrencyInit(); + } + + private void CurrencyInit() + { + #region FromUAH + currencies.Add(new Currency() + { + From = Currencies.UAH, + To = Currencies.USD, + Rate = 1 / usd + }); + + currencies.Add(new Currency() + { + From = Currencies.UAH, + To = Currencies.EUR, + Rate = 1 / eur + }); + + currencies.Add(new Currency() + { + From = Currencies.UAH, + To = Currencies.RUB, + Rate = 1 / rub + }); + + currencies.Add(new Currency() + { + From = Currencies.UAH, + To = Currencies.UAH, + Rate = 1 + }); + #endregion + #region FromRUB + currencies.Add(new Currency() + { + From = Currencies.RUB, + To = Currencies.USD, + Rate = rub / usd + }); + + currencies.Add(new Currency() + { + From = Currencies.RUB, + To = Currencies.EUR, + Rate = rub / eur + }); + + currencies.Add(new Currency() + { + From = Currencies.RUB, + To = Currencies.RUB, + Rate = 1 + }); + + currencies.Add(new Currency() + { + From = Currencies.RUB, + To = Currencies.UAH, + Rate = rub + }); + #endregion + #region FromEUR + currencies.Add(new Currency() + { + From = Currencies.EUR, + To = Currencies.USD, + Rate = eur / usd + }); + + currencies.Add(new Currency() + { + From = Currencies.EUR, + To = Currencies.EUR, + Rate = 1 + }); + + currencies.Add(new Currency() + { + From = Currencies.EUR, + To = Currencies.RUB, + Rate = eur / rub + }); + + currencies.Add(new Currency() + { + From = Currencies.EUR, + To = Currencies.UAH, + Rate = eur + }); + #endregion + #region FromUSD + currencies.Add(new Currency() + { + From = Currencies.USD, + To = Currencies.USD, + Rate = 1 + }); + + currencies.Add(new Currency() + { + From = Currencies.USD, + To = Currencies.EUR, + Rate = usd / eur + }); + + currencies.Add(new Currency() + { + From = Currencies.USD, + To = Currencies.RUB, + Rate = usd / rub + }); + + currencies.Add(new Currency() + { + From = Currencies.USD, + To = Currencies.UAH, + Rate = usd + }); + #endregion + } + + public double Convert(double amount, Currencies from, Currencies to) + { + Currency currency = this.currencies.Where(cur => cur.From == from && cur.To == to).First(); + return amount * currency.Rate; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_6/Currencies.cs b/PisotskiyPavel/Task_2/Task_2_6/Currencies.cs new file mode 100644 index 0000000..02e8b43 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_6/Currencies.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_6 +{ + public enum Currencies + { + UAH, + EUR, + USD, + RUB + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_6/Currency.cs b/PisotskiyPavel/Task_2/Task_2_6/Currency.cs new file mode 100644 index 0000000..0dfff11 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_6/Currency.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_6 +{ + class Currency + { + public double Rate { get; set; } + + public Currencies From { get; set; } + + public Currencies To { get; set; } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_6/Program.cs b/PisotskiyPavel/Task_2/Task_2_6/Program.cs new file mode 100644 index 0000000..5603d1f --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_6/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_6 +{ + class Program + { + static void Main(string[] args) + { + Console.Write("Из какой валюты вы хотите перевести: UAH, EUR, USD, RUB? "); + string from = Console.ReadLine(); + Console.Write("В какую валюты вы хотите перевести: UAH, EUR, USD, RUB? "); + string to = Console.ReadLine(); + Console.Write("Введите сумму, необходимую для перевода: "); + double amount = Convert.ToDouble(Console.ReadLine()); + + Converter currencyConverter = new Converter(25.6502334, 28.1921715, 0.409172523); + double result = currencyConverter.Convert(amount, GetCurrencyName(from), GetCurrencyName(to)); + Console.WriteLine("{0} {1} = {2} {3}", amount, from.ToUpper(), result, to.ToUpper()); + + Console.ReadLine(); + } + + static Currencies GetCurrencyName(string name) + { + return (Currencies)Enum.Parse(typeof(Currencies), name.ToUpper()); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_6/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_6/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..52ea6f5 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_6/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_6")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_6")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c7d70715-7b79-423a-92a7-e1af7aab2074")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_6/Task_2_6.csproj b/PisotskiyPavel/Task_2/Task_2_6/Task_2_6.csproj new file mode 100644 index 0000000..501c8d3 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_6/Task_2_6.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {C7D70715-7B79-423A-92A7-E1AF7AAB2074} + Exe + Properties + Task_2_6 + Task_2_6 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_2/Task_2_7/App.config b/PisotskiyPavel/Task_2/Task_2_7/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_7/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_7/Employee.cs b/PisotskiyPavel/Task_2/Task_2_7/Employee.cs new file mode 100644 index 0000000..954e4c9 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_7/Employee.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_7 +{ + class Employee + { + public string FirstName { get; set; } + public string SecondName { get; set; } + public int Experience { get; set; } + public EmployeePosition Position { get; set; } + + private double tax = 0.18; + + public Employee(string firstName, string secondName) + { + this.FirstName = firstName; + this.SecondName = secondName; + } + + public double GetSalary() + { + return Position.FixedRate + Experience * Position.Surcharge; + } + + public double GetTaxLevy() + { + return GetSalary() * tax; + } + + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_7/EmployeePosition.cs b/PisotskiyPavel/Task_2/Task_2_7/EmployeePosition.cs new file mode 100644 index 0000000..5cd29f3 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_7/EmployeePosition.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_7 +{ + class EmployeePosition + { + public string PositionName { get; set; } + public double FixedRate { get; set; } + public double Surcharge { get; set; } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_7/Program.cs b/PisotskiyPavel/Task_2/Task_2_7/Program.cs new file mode 100644 index 0000000..6db174d --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_7/Program.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_7 +{ + class Program + { + static void Main(string[] args) + { + IEnumerable employees = GetEmployees(); + + foreach (var employee in employees) + { + Console.WriteLine("{0} {1}:", employee.FirstName, employee.SecondName); + Console.WriteLine("\tДолжность: {0}",employee.Position.PositionName); + Console.WriteLine("\tСтаж: {0}", employee.Experience); + Console.WriteLine("\tЗар. плата: {0}", employee.GetSalary()); + Console.WriteLine("\tНалоговый сбор: {0}", employee.GetTaxLevy()); + Console.WriteLine(); + } + + Console.ReadLine(); + } + + static IEnumerable GetEmployees() + { + EmployeePosition director = new EmployeePosition() + { + FixedRate = 10000, + PositionName = "Директор", + Surcharge = 500 + }; + + EmployeePosition manager = new EmployeePosition() + { + FixedRate = 5000, + PositionName = "Менеджер", + Surcharge = 250 + }; + + EmployeePosition salesman = new EmployeePosition() + { + FixedRate = 2000, + PositionName = "Продавец", + Surcharge = 100 + }; + + + return new Employee[] + { + new Employee("Владимир", "Владимиров") + { + Position = director, + Experience = 15 + }, + new Employee("Екатерина", "Семенова") + { + Position = manager, + Experience = 10 + }, + new Employee("Светлана", "Петрова") + { + Position = salesman, + Experience = 5 + } + }; + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_7/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_7/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1e65e10 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_7/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_7")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_7")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ea4d918b-30f5-4f23-9fb9-af495efa0c5c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_7/Task_2_7.csproj b/PisotskiyPavel/Task_2/Task_2_7/Task_2_7.csproj new file mode 100644 index 0000000..d66b1cf --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_7/Task_2_7.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {EA4D918B-30F5-4F23-9FB9-AF495EFA0C5C} + Exe + Properties + Task_2_7 + Task_2_7 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_2/Task_2_8/App.config b/PisotskiyPavel/Task_2/Task_2_8/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_8/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_2/Task_2_8/Invoice.cs b/PisotskiyPavel/Task_2/Task_2_8/Invoice.cs new file mode 100644 index 0000000..f282fba --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_8/Invoice.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_8 +{ + class Invoice + { + private readonly int account; + private readonly string customer, provider; + private string article; + private int quantity; + private double nds = 0.18; + + public Invoice(int account, string customer, string provider) + { + this.account = account; + this.customer = customer; + this.provider = provider; + } + + public int Account { get { return account; } } + public string Customer { get { return customer; } } + public string Provider { get { return provider; } } + public string Article + { + get { return article; } + set { article = value; } + } + + public int Quantity + { + get { return quantity; } + set { quantity = value; } + } + + public double Price { get; set; } + + public double CostWithoutNds() + { + return Price * Quantity; + } + + public double CostWithNds() + { + return CostWithoutNds() - (CostWithoutNds() * nds); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_8/Program.cs b/PisotskiyPavel/Task_2/Task_2_8/Program.cs new file mode 100644 index 0000000..aee7c26 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_8/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_2_8 +{ + class Program + { + static void Main(string[] args) + { + Invoice invoice = new Invoice(32566, "Писоцкий Павел", "Google"); + invoice.Article = "Регистрация доменного имени: .ua"; + invoice.Quantity = 2; + invoice.Price = 1000; + Console.WriteLine("Счет №{0}", invoice.Account); + Console.WriteLine("Заказчик: {0}", invoice.Customer); + Console.WriteLine("Поставщик: {0}", invoice.Provider); + Console.WriteLine("{0} - {1}шт.", invoice.Article, invoice.Quantity); + Console.WriteLine("Цена (без НДС): {0}",invoice.CostWithoutNds()); + Console.WriteLine("Цена (с НДС): {0}", invoice.CostWithNds()); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_2/Task_2_8/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_2/Task_2_8/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9a79b2a --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_8/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_2_8")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_2_8")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9741c7a3-32a1-43cf-81c1-63f482f1fa51")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_2/Task_2_8/Task_2_8.csproj b/PisotskiyPavel/Task_2/Task_2_8/Task_2_8.csproj new file mode 100644 index 0000000..366b028 --- /dev/null +++ b/PisotskiyPavel/Task_2/Task_2_8/Task_2_8.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {9741C7A3-32A1-43CF-81C1-63F482F1FA51} + Exe + Properties + Task_2_8 + Task_2_8 + v4.5.2 + 512 + 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 From bc39a724ecab08e3ea233710d0368b7757f1b2c1 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Wed, 26 Oct 2016 19:05:35 +0300 Subject: [PATCH 03/12] Task 3 is done --- PisotskiyPavel/Task_3/Task_3.sln | 40 ++++++++++++ PisotskiyPavel/Task_3/Task_3_1/App.config | 6 ++ .../Task_3/Task_3_1/BlackAndWhitePrinter.cs | 26 ++++++++ .../Task_3/Task_3_1/ColorPrinter.cs | 32 +++++++++ PisotskiyPavel/Task_3/Task_3_1/Printer.cs | 16 +++++ PisotskiyPavel/Task_3/Task_3_1/Program.cs | 32 +++++++++ .../Task_3_1/Properties/AssemblyInfo.cs | 36 ++++++++++ .../Task_3/Task_3_1/Task_3_1.csproj | 63 ++++++++++++++++++ PisotskiyPavel/Task_3/Task_3_2/App.config | 6 ++ PisotskiyPavel/Task_3/Task_3_2/BadPupil.cs | 35 ++++++++++ PisotskiyPavel/Task_3/Task_3_2/ClassRoom.cs | 39 +++++++++++ .../Task_3/Task_3_2/ExcelentPupil.cs | 35 ++++++++++ PisotskiyPavel/Task_3/Task_3_2/GoodPupil.cs | 35 ++++++++++ PisotskiyPavel/Task_3/Task_3_2/Program.cs | 27 ++++++++ .../Task_3_2/Properties/AssemblyInfo.cs | 36 ++++++++++ PisotskiyPavel/Task_3/Task_3_2/Pupil.cs | 23 +++++++ .../Task_3/Task_3_2/Task_3_2.csproj | 65 +++++++++++++++++++ PisotskiyPavel/Task_3/Task_3_3/App.config | 6 ++ PisotskiyPavel/Task_3/Task_3_3/Car.cs | 16 +++++ PisotskiyPavel/Task_3/Task_3_3/Plane.cs | 27 ++++++++ PisotskiyPavel/Task_3/Task_3_3/Program.cs | 30 +++++++++ .../Task_3_3/Properties/AssemblyInfo.cs | 36 ++++++++++ PisotskiyPavel/Task_3/Task_3_3/Ship.cs | 27 ++++++++ .../Task_3/Task_3_3/Task_3_3.csproj | 65 +++++++++++++++++++ PisotskiyPavel/Task_3/Task_3_3/Vehicle.cs | 36 ++++++++++ PisotskiyPavel/Task_3/Task_3_4/App.config | 6 ++ .../Task_3/Task_3_4/DocumentWorker.cs | 26 ++++++++ .../Task_3/Task_3_4/ExpertDocumentWorker.cs | 16 +++++ .../Task_3/Task_3_4/ProDocumentWorker.cs | 21 ++++++ PisotskiyPavel/Task_3/Task_3_4/Program.cs | 37 +++++++++++ .../Task_3_4/Properties/AssemblyInfo.cs | 36 ++++++++++ .../Task_3/Task_3_4/Task_3_4.csproj | 63 ++++++++++++++++++ 32 files changed, 1000 insertions(+) create mode 100644 PisotskiyPavel/Task_3/Task_3.sln create mode 100644 PisotskiyPavel/Task_3/Task_3_1/App.config create mode 100644 PisotskiyPavel/Task_3/Task_3_1/BlackAndWhitePrinter.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_1/ColorPrinter.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_1/Printer.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_1/Program.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_1/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_1/Task_3_1.csproj create mode 100644 PisotskiyPavel/Task_3/Task_3_2/App.config create mode 100644 PisotskiyPavel/Task_3/Task_3_2/BadPupil.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_2/ClassRoom.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_2/ExcelentPupil.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_2/GoodPupil.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_2/Program.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_2/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_2/Pupil.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_2/Task_3_2.csproj create mode 100644 PisotskiyPavel/Task_3/Task_3_3/App.config create mode 100644 PisotskiyPavel/Task_3/Task_3_3/Car.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_3/Plane.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_3/Program.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_3/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_3/Ship.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_3/Task_3_3.csproj create mode 100644 PisotskiyPavel/Task_3/Task_3_3/Vehicle.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_4/App.config create mode 100644 PisotskiyPavel/Task_3/Task_3_4/DocumentWorker.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_4/ExpertDocumentWorker.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_4/ProDocumentWorker.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_4/Program.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_4/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_3/Task_3_4/Task_3_4.csproj diff --git a/PisotskiyPavel/Task_3/Task_3.sln b/PisotskiyPavel/Task_3/Task_3.sln new file mode 100644 index 0000000..b0882a1 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_3_1", "Task_3_1\Task_3_1.csproj", "{1FAE4ED3-A1C4-4AD5-8868-32CCEFE20207}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_3_2", "Task_3_2\Task_3_2.csproj", "{4CFF2541-5DA7-4E18-808B-5CD879F084C3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_3_3", "Task_3_3\Task_3_3.csproj", "{B98546E7-6DA7-4377-AEE7-6C57D5F172F1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_3_4", "Task_3_4\Task_3_4.csproj", "{88729FF3-52D6-44C4-9AAC-0BE0DB52F2A3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1FAE4ED3-A1C4-4AD5-8868-32CCEFE20207}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FAE4ED3-A1C4-4AD5-8868-32CCEFE20207}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FAE4ED3-A1C4-4AD5-8868-32CCEFE20207}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FAE4ED3-A1C4-4AD5-8868-32CCEFE20207}.Release|Any CPU.Build.0 = Release|Any CPU + {4CFF2541-5DA7-4E18-808B-5CD879F084C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4CFF2541-5DA7-4E18-808B-5CD879F084C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4CFF2541-5DA7-4E18-808B-5CD879F084C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4CFF2541-5DA7-4E18-808B-5CD879F084C3}.Release|Any CPU.Build.0 = Release|Any CPU + {B98546E7-6DA7-4377-AEE7-6C57D5F172F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B98546E7-6DA7-4377-AEE7-6C57D5F172F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B98546E7-6DA7-4377-AEE7-6C57D5F172F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B98546E7-6DA7-4377-AEE7-6C57D5F172F1}.Release|Any CPU.Build.0 = Release|Any CPU + {88729FF3-52D6-44C4-9AAC-0BE0DB52F2A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88729FF3-52D6-44C4-9AAC-0BE0DB52F2A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88729FF3-52D6-44C4-9AAC-0BE0DB52F2A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88729FF3-52D6-44C4-9AAC-0BE0DB52F2A3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PisotskiyPavel/Task_3/Task_3_1/App.config b/PisotskiyPavel/Task_3/Task_3_1/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_3/Task_3_1/BlackAndWhitePrinter.cs b/PisotskiyPavel/Task_3/Task_3_1/BlackAndWhitePrinter.cs new file mode 100644 index 0000000..69049f5 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_1/BlackAndWhitePrinter.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_1 +{ + class BlackAndWhitePrinter : Printer + { + private readonly ConsoleColor background = ConsoleColor.White; + private readonly ConsoleColor foreground = ConsoleColor.Black; + + public override void Print(string value) + { + ConsoleColor oldBackground = Console.BackgroundColor; + ConsoleColor oldForeground = Console.ForegroundColor; + + Console.ForegroundColor = foreground; + Console.BackgroundColor = background; + base.Print(value); + Console.ForegroundColor = oldForeground; + Console.BackgroundColor = oldBackground; + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_1/ColorPrinter.cs b/PisotskiyPavel/Task_3/Task_3_1/ColorPrinter.cs new file mode 100644 index 0000000..3333d52 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_1/ColorPrinter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_1 +{ + class ColorPrinter : Printer + { + public ConsoleColor Background { get; set; } + public ConsoleColor Foreground { get; set; } + + public ColorPrinter() + { + Background = ConsoleColor.White; + Foreground = ConsoleColor.Black; + } + + public override void Print(string value) + { + ConsoleColor oldBackground = Console.BackgroundColor; + ConsoleColor oldForeground = Console.ForegroundColor; + + Console.ForegroundColor = Foreground; + Console.BackgroundColor = Background; + base.Print(value); + Console.ForegroundColor = oldForeground; + Console.BackgroundColor = oldBackground; + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_1/Printer.cs b/PisotskiyPavel/Task_3/Task_3_1/Printer.cs new file mode 100644 index 0000000..89a59c7 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_1/Printer.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_1 +{ + class Printer + { + public virtual void Print(string value) + { + Console.WriteLine(value); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_1/Program.cs b/PisotskiyPavel/Task_3/Task_3_1/Program.cs new file mode 100644 index 0000000..f9f8df2 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_1/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_1 +{ + class Program + { + static void Main(string[] args) + { + IEnumerable printers = new Printer[] + { + new ColorPrinter() { Background = ConsoleColor.DarkYellow, Foreground = ConsoleColor.Yellow }, + new BlackAndWhitePrinter() + }; + + foreach (Printer printer in printers) + { + Print(printer, "Hello World!"); + } + + Console.ReadLine(); + } + + static void Print(Printer printer, string value) + { + printer.Print(value); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_1/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_3/Task_3_1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..151b162 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_3_1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_3_1")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1fae4ed3-a1c4-4ad5-8868-32ccefe20207")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_3/Task_3_1/Task_3_1.csproj b/PisotskiyPavel/Task_3/Task_3_1/Task_3_1.csproj new file mode 100644 index 0000000..5f14924 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_1/Task_3_1.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {1FAE4ED3-A1C4-4AD5-8868-32CCEFE20207} + Exe + Properties + Task_3_1 + Task_3_1 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_3/Task_3_2/App.config b/PisotskiyPavel/Task_3/Task_3_2/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_3/Task_3_2/BadPupil.cs b/PisotskiyPavel/Task_3/Task_3_2/BadPupil.cs new file mode 100644 index 0000000..d12cd6f --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/BadPupil.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_2 +{ + class BadPupil : Pupil + { + public BadPupil(string name) : base(name) + { + } + + public override void Read() + { + Console.WriteLine("{0} - плохо пишет", Name); + } + + public override void Relax() + { + Console.WriteLine("{0} - много отдыхает", Name); + } + + public override void Study() + { + Console.WriteLine("{0} - не учит уроки", Name); + } + + public override void Write() + { + Console.WriteLine("{0} - плохо читает", Name); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_2/ClassRoom.cs b/PisotskiyPavel/Task_3/Task_3_2/ClassRoom.cs new file mode 100644 index 0000000..19b9e68 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/ClassRoom.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_2 +{ + class ClassRoom + { + private readonly Pupil[] pupils = new Pupil[4]; + + public IEnumerable Pupils + { + get + { + return pupils.Where(p => p != null); + } + } + + public ClassRoom(Pupil pupilFirst, Pupil pupilSecond, Pupil pupilThird, Pupil pupilFourth) + : this(pupilFirst, pupilSecond, pupilThird) + { + pupils[3] = pupilFourth; + } + + public ClassRoom(Pupil pupilFirst, Pupil pupilSecond, Pupil pupilThird) + : this(pupilFirst, pupilSecond) + { + pupils[2] = pupilThird; + } + + public ClassRoom(Pupil pupilFirst, Pupil pupilSecond) + { + pupils[0] = pupilFirst; + pupils[1] = pupilSecond; + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_2/ExcelentPupil.cs b/PisotskiyPavel/Task_3/Task_3_2/ExcelentPupil.cs new file mode 100644 index 0000000..caf2c70 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/ExcelentPupil.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_2 +{ + class ExcelentPupil : Pupil + { + public ExcelentPupil(string name) : base(name) + { + } + + public override void Read() + { + Console.WriteLine("{0} - отлично читает", Name); + } + + public override void Relax() + { + Console.WriteLine("{0} - читает книги", Name); + } + + public override void Study() + { + Console.WriteLine("{0} - отлично учится", Name); + } + + public override void Write() + { + Console.WriteLine("{0} - отлично пишет", Name); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_2/GoodPupil.cs b/PisotskiyPavel/Task_3/Task_3_2/GoodPupil.cs new file mode 100644 index 0000000..ba7fc50 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/GoodPupil.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_2 +{ + class GoodPupil : Pupil + { + public GoodPupil(string name) : base(name) + { + } + + public override void Read() + { + Console.WriteLine("{0} - нормально читает", Name); + } + + public override void Relax() + { + Console.WriteLine("{0} - в свободное время отдыхает", Name); + } + + public override void Study() + { + Console.WriteLine("{0} - хорошо учится", Name); + } + + public override void Write() + { + Console.WriteLine("{0} - нормально пишет", Name); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_2/Program.cs b/PisotskiyPavel/Task_3/Task_3_2/Program.cs new file mode 100644 index 0000000..e8f35e1 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_2 +{ + class Program + { + static void Main(string[] args) + { + ClassRoom classRoom = new ClassRoom(new BadPupil("Philip Guzman"), new GoodPupil("Sean Luna"), new GoodPupil("Ben Harris"), new ExcelentPupil("Chris Bradley")); + + foreach (Pupil pupil in classRoom.Pupils) + { + pupil.Read(); + pupil.Write(); + pupil.Study(); + pupil.Relax(); + Console.WriteLine(new string('-', Console.BufferWidth - 1)); + } + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_2/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_3/Task_3_2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a47acc0 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_3_2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_3_2")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4cff2541-5da7-4e18-808b-5cd879f084c3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_3/Task_3_2/Pupil.cs b/PisotskiyPavel/Task_3/Task_3_2/Pupil.cs new file mode 100644 index 0000000..9ce0fde --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/Pupil.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_2 +{ + abstract class Pupil + { + public abstract void Study(); + public abstract void Write(); + public abstract void Read(); + public abstract void Relax(); + + public string Name { get; set; } + + public Pupil(string name) + { + Name = name; + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_2/Task_3_2.csproj b/PisotskiyPavel/Task_3/Task_3_2/Task_3_2.csproj new file mode 100644 index 0000000..28981a1 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_2/Task_3_2.csproj @@ -0,0 +1,65 @@ + + + + + Debug + AnyCPU + {4CFF2541-5DA7-4E18-808B-5CD879F084C3} + Exe + Properties + Task_3_2 + Task_3_2 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_3/Task_3_3/App.config b/PisotskiyPavel/Task_3/Task_3_3/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_3/Task_3_3/Car.cs b/PisotskiyPavel/Task_3/Task_3_3/Car.cs new file mode 100644 index 0000000..d75d05b --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/Car.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_3 +{ + class Car : Vehicle + { + public Car(double price, double speed, int yearOfIssue) + : base(price, speed, yearOfIssue) + { + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_3/Plane.cs b/PisotskiyPavel/Task_3/Task_3_3/Plane.cs new file mode 100644 index 0000000..8f31e9d --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/Plane.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_3 +{ + class Plane : Vehicle + { + public Plane(double price, double speed, int yearOfIssue) + : base(price, speed, yearOfIssue) + { + } + + public double Height { get; set; } + public int PassengersNumber { get; set; } + + public override void PrintInfo() + { + base.PrintInfo(); + Console.WriteLine("Высота: {0}", Height); + Console.WriteLine("Количество пассажиров: {0}", PassengersNumber); + } + + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_3/Program.cs b/PisotskiyPavel/Task_3/Task_3_3/Program.cs new file mode 100644 index 0000000..4346018 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/Program.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Device.Location; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_3 +{ + class Program + { + static void Main(string[] args) + { + IEnumerable vehicles = new Vehicle[] + { + new Ship(100000, 45.5, 2002, "PORT AUX FRANCAIS") { PassengersNumber = 10, Coordinates = new GeoCoordinate(89.232258, 121.19878) }, + new Plane(250000, 120, 2005) {PassengersNumber = 2, Height = 3000,Coordinates = new GeoCoordinate(45.251258, 12.159878) }, + new Car(90000, 165, 2001) { Coordinates = new GeoCoordinate(43.23212258, 57.3278) } + }; + + foreach (Vehicle vehicle in vehicles) + { + vehicle.PrintInfo(); + Console.WriteLine(new string('-', Console.BufferWidth - 1)); + } + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_3/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_3/Task_3_3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e3e99d1 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_3_3")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_3_3")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b98546e7-6da7-4377-aee7-6c57d5f172f1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_3/Task_3_3/Ship.cs b/PisotskiyPavel/Task_3/Task_3_3/Ship.cs new file mode 100644 index 0000000..f6f6068 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/Ship.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_3 +{ + class Ship : Vehicle + { + public Ship(double price, double speed, int yearOfIssue, string registryPort) + : base(price, speed, yearOfIssue) + { + RegistryPort = registryPort; + } + + public int PassengersNumber { get; set; } + public string RegistryPort { get; set; } + + public override void PrintInfo() + { + base.PrintInfo(); + Console.WriteLine("Порт приписки: {0}", RegistryPort); + Console.WriteLine("Количество пассажиров: {0}", PassengersNumber); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_3/Task_3_3.csproj b/PisotskiyPavel/Task_3/Task_3_3/Task_3_3.csproj new file mode 100644 index 0000000..61dd492 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/Task_3_3.csproj @@ -0,0 +1,65 @@ + + + + + Debug + AnyCPU + {B98546E7-6DA7-4377-AEE7-6C57D5F172F1} + Exe + Properties + Task_3_3 + Task_3_3 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_3/Task_3_3/Vehicle.cs b/PisotskiyPavel/Task_3/Task_3_3/Vehicle.cs new file mode 100644 index 0000000..473b754 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_3/Vehicle.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Device.Location; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_3 +{ + abstract class Vehicle + { + public GeoCoordinate Coordinates { get; set; } + + public double Price { get; set; } + + public double Speed { get; protected set; } + + public int YearOfIssue { get; protected set; } + + public Vehicle(double price, double speed, int yearOfIssue) + { + Price = price; + Speed = speed; + YearOfIssue = yearOfIssue; + } + + public virtual void PrintInfo() + { + Console.WriteLine(this.GetType().Name); + Console.WriteLine("Координаты: {0}", Coordinates.ToString()); + Console.WriteLine("Цена: {0}", Price); + Console.WriteLine("Скорость: {0}", Speed); + Console.WriteLine("Год выпуска: {0}", YearOfIssue); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_4/App.config b/PisotskiyPavel/Task_3/Task_3_4/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_4/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_3/Task_3_4/DocumentWorker.cs b/PisotskiyPavel/Task_3/Task_3_4/DocumentWorker.cs new file mode 100644 index 0000000..3625b62 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_4/DocumentWorker.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_4 +{ + class DocumentWorker + { + public virtual void OpenDocument() + { + Console.WriteLine("Документ открыт."); + } + + public virtual void EditDocument() + { + Console.WriteLine("Редактирование документа доступно в версии Pro."); + } + + public virtual void SaveDocument() + { + Console.WriteLine("Сохранение документа доступно в версии Pro."); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_4/ExpertDocumentWorker.cs b/PisotskiyPavel/Task_3/Task_3_4/ExpertDocumentWorker.cs new file mode 100644 index 0000000..d0bf88d --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_4/ExpertDocumentWorker.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_4 +{ + class ExpertDocumentWorker : ProDocumentWorker + { + public override void SaveDocument() + { + Console.WriteLine("Документ сохранен в новом формате."); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_4/ProDocumentWorker.cs b/PisotskiyPavel/Task_3/Task_3_4/ProDocumentWorker.cs new file mode 100644 index 0000000..0fd05c9 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_4/ProDocumentWorker.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_4 +{ + class ProDocumentWorker : DocumentWorker + { + public override void EditDocument() + { + Console.WriteLine("Документ отредактирован."); + } + + public override void SaveDocument() + { + Console.WriteLine("Документ сохранен в старом формате, сохранение в остальных форматах доступно в вертии Expert."); + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_4/Program.cs b/PisotskiyPavel/Task_3/Task_3_4/Program.cs new file mode 100644 index 0000000..af1634d --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_4/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_3_4 +{ + class Program + { + static void Main(string[] args) + { + Console.Write("Введите лицензионный ключ: "); + string key = Console.ReadLine(); + DocumentWorker doc = GetDocumentWorker(key); + doc.OpenDocument(); + doc.EditDocument(); + doc.SaveDocument(); + + Console.ReadLine(); + } + + static DocumentWorker GetDocumentWorker(string key) + { + DocumentWorker doc; + + switch (key.ToLower()) + { + case "pro": doc = new ProDocumentWorker(); break; + case "exp": doc = new ExpertDocumentWorker(); break; + default: doc = new DocumentWorker(); break; + } + + return doc; + } + } +} diff --git a/PisotskiyPavel/Task_3/Task_3_4/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_3/Task_3_4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..36e0d09 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_3_4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_3_4")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("88729ff3-52d6-44c4-9aac-0be0db52f2a3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_3/Task_3_4/Task_3_4.csproj b/PisotskiyPavel/Task_3/Task_3_4/Task_3_4.csproj new file mode 100644 index 0000000..c5f0c44 --- /dev/null +++ b/PisotskiyPavel/Task_3/Task_3_4/Task_3_4.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {88729FF3-52D6-44C4-9AAC-0BE0DB52F2A3} + Exe + Properties + Task_3_4 + Task_3_4 + v4.5.2 + 512 + 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 From 0555355c52bd1e58a7ccadf2326287bfbe02c3ce Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Thu, 27 Oct 2016 15:36:57 +0300 Subject: [PATCH 04/12] Task 4 is done --- PisotskiyPavel/Task_4/Task_4.sln | 28 ++++++++ .../Task_4/Task_4_1/AbstractHandler.cs | 16 +++++ PisotskiyPavel/Task_4/Task_4_1/App.config | 6 ++ PisotskiyPavel/Task_4/Task_4_1/DOCHandler.cs | 32 +++++++++ .../Task_4/Task_4_1/FilesHandler.cs | 27 ++++++++ .../Task_4/Task_4_1/IFilesHandler.cs | 14 ++++ PisotskiyPavel/Task_4/Task_4_1/Program.cs | 45 +++++++++++++ .../Task_4_1/Properties/AssemblyInfo.cs | 36 ++++++++++ PisotskiyPavel/Task_4/Task_4_1/TXTHandler.cs | 32 +++++++++ .../Task_4/Task_4_1/Task_4_1.csproj | 66 +++++++++++++++++++ PisotskiyPavel/Task_4/Task_4_1/XMLHandler.cs | 32 +++++++++ PisotskiyPavel/Task_4/Task_4_2/App.config | 6 ++ PisotskiyPavel/Task_4/Task_4_2/IPlayable.cs | 15 +++++ PisotskiyPavel/Task_4/Task_4_2/IRecordable.cs | 15 +++++ PisotskiyPavel/Task_4/Task_4_2/Player.cs | 42 ++++++++++++ PisotskiyPavel/Task_4/Task_4_2/Program.cs | 28 ++++++++ .../Task_4_2/Properties/AssemblyInfo.cs | 36 ++++++++++ .../Task_4/Task_4_2/Task_4_2.csproj | 63 ++++++++++++++++++ 18 files changed, 539 insertions(+) create mode 100644 PisotskiyPavel/Task_4/Task_4.sln create mode 100644 PisotskiyPavel/Task_4/Task_4_1/AbstractHandler.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_1/App.config create mode 100644 PisotskiyPavel/Task_4/Task_4_1/DOCHandler.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_1/FilesHandler.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_1/IFilesHandler.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_1/Program.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_1/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_1/TXTHandler.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_1/Task_4_1.csproj create mode 100644 PisotskiyPavel/Task_4/Task_4_1/XMLHandler.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_2/App.config create mode 100644 PisotskiyPavel/Task_4/Task_4_2/IPlayable.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_2/IRecordable.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_2/Player.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_2/Program.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_2/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_4/Task_4_2/Task_4_2.csproj diff --git a/PisotskiyPavel/Task_4/Task_4.sln b/PisotskiyPavel/Task_4/Task_4.sln new file mode 100644 index 0000000..4d22233 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_4_1", "Task_4_1\Task_4_1.csproj", "{340E4524-6EF1-4052-831A-E7437D1B468F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_4_2", "Task_4_2\Task_4_2.csproj", "{F12D84B8-230A-47D5-9DF9-6BCD1586606F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {340E4524-6EF1-4052-831A-E7437D1B468F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {340E4524-6EF1-4052-831A-E7437D1B468F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {340E4524-6EF1-4052-831A-E7437D1B468F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {340E4524-6EF1-4052-831A-E7437D1B468F}.Release|Any CPU.Build.0 = Release|Any CPU + {F12D84B8-230A-47D5-9DF9-6BCD1586606F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F12D84B8-230A-47D5-9DF9-6BCD1586606F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F12D84B8-230A-47D5-9DF9-6BCD1586606F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F12D84B8-230A-47D5-9DF9-6BCD1586606F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PisotskiyPavel/Task_4/Task_4_1/AbstractHandler.cs b/PisotskiyPavel/Task_4/Task_4_1/AbstractHandler.cs new file mode 100644 index 0000000..e64bc2e --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/AbstractHandler.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_1 +{ + abstract class AbstractHandler + { + public abstract void Open(); + public abstract void Create(); + public abstract void Change(); + public abstract void Save(); + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_1/App.config b/PisotskiyPavel/Task_4/Task_4_1/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_4/Task_4_1/DOCHandler.cs b/PisotskiyPavel/Task_4/Task_4_1/DOCHandler.cs new file mode 100644 index 0000000..faf5946 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/DOCHandler.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_1 +{ + class DOCHandler : AbstractHandler + { + public override void Change() + { + Console.WriteLine("doc-файл - изменён"); + } + + public override void Create() + { + Console.WriteLine("doc-файл - создан"); + } + + public override void Open() + { + Console.WriteLine("doc-файл - открыт"); + } + + public override void Save() + { + Console.WriteLine("doc-файл - сохранён"); + } + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_1/FilesHandler.cs b/PisotskiyPavel/Task_4/Task_4_1/FilesHandler.cs new file mode 100644 index 0000000..cf72d84 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/FilesHandler.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_1 +{ + class FilesHandler : IFilesHandler + { + private readonly IDictionary files; + + public FilesHandler() + { + files = new Dictionary(); + } + public AbstractHandler GetHandler(string extension) + { + return files[extension.ToLower()]; + } + + public void Register(string extension, AbstractHandler handler) + { + files.Add(extension.ToLower(), handler); + } + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_1/IFilesHandler.cs b/PisotskiyPavel/Task_4/Task_4_1/IFilesHandler.cs new file mode 100644 index 0000000..0e6ed9e --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/IFilesHandler.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_1 +{ + interface IFilesHandler + { + void Register(string extension, AbstractHandler handler); + AbstractHandler GetHandler(string extension); + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_1/Program.cs b/PisotskiyPavel/Task_4/Task_4_1/Program.cs new file mode 100644 index 0000000..29b1233 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/Program.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_1 +{ + class Program + { + static void Main(string[] args) + { + IFilesHandler filesHandler = GetFilesHandler(); + Console.Write("Введите формат файла (например .doc): "); + string extension = Console.ReadLine(); + + try + { + AbstractHandler handler = filesHandler.GetHandler(extension); + handler.Create(); + handler.Open(); + handler.Change(); + handler.Save(); + } + catch (KeyNotFoundException) + { + Console.WriteLine("Данный формат не поддерживается!!!"); + } + + + Console.ReadLine(); + } + + static IFilesHandler GetFilesHandler() + { + IFilesHandler filesHandler = new FilesHandler(); + + filesHandler.Register(".txt", new TXTHandler()); + filesHandler.Register(".xml", new XMLHandler()); + filesHandler.Register(".doc", new DOCHandler()); + + return filesHandler; + } + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_1/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_4/Task_4_1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..935ce98 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_4_1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_4_1")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("340e4524-6ef1-4052-831a-e7437d1b468f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_4/Task_4_1/TXTHandler.cs b/PisotskiyPavel/Task_4/Task_4_1/TXTHandler.cs new file mode 100644 index 0000000..add0ba1 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/TXTHandler.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_1 +{ + class TXTHandler : AbstractHandler + { + public override void Change() + { + Console.WriteLine("txt-файл - изменён"); + } + + public override void Create() + { + Console.WriteLine("txt-файл - создан"); + } + + public override void Open() + { + Console.WriteLine("txt-файл - открыт"); + } + + public override void Save() + { + Console.WriteLine("txt-файл - сохранён"); + } + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_1/Task_4_1.csproj b/PisotskiyPavel/Task_4/Task_4_1/Task_4_1.csproj new file mode 100644 index 0000000..7c164d9 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/Task_4_1.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {340E4524-6EF1-4052-831A-E7437D1B468F} + Exe + Properties + Task_4_1 + Task_4_1 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_4/Task_4_1/XMLHandler.cs b/PisotskiyPavel/Task_4/Task_4_1/XMLHandler.cs new file mode 100644 index 0000000..30b3f23 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_1/XMLHandler.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_1 +{ + class XMLHandler : AbstractHandler + { + public override void Change() + { + Console.WriteLine("xml-файл - изменён"); + } + + public override void Create() + { + Console.WriteLine("xml-файл - создан"); + } + + public override void Open() + { + Console.WriteLine("xml-файл - открыт"); + } + + public override void Save() + { + Console.WriteLine("xml-файл - сохранён"); + } + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_2/App.config b/PisotskiyPavel/Task_4/Task_4_2/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_4/Task_4_2/IPlayable.cs b/PisotskiyPavel/Task_4/Task_4_2/IPlayable.cs new file mode 100644 index 0000000..fb8c964 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_2/IPlayable.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_2 +{ + interface IPlayable + { + void Play(); + void Pause(); + void Stop(); + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_2/IRecordable.cs b/PisotskiyPavel/Task_4/Task_4_2/IRecordable.cs new file mode 100644 index 0000000..ff65d1a --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_2/IRecordable.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_2 +{ + interface IRecordable + { + void Record(); + void Pause(); + void Stop(); + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_2/Player.cs b/PisotskiyPavel/Task_4/Task_4_2/Player.cs new file mode 100644 index 0000000..7fa84ad --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_2/Player.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_2 +{ + class Player : IRecordable, IPlayable + { + public void Play() + { + Console.WriteLine("Проигрывание"); + } + + public void Record() + { + Console.WriteLine("Запись"); + } + + void IRecordable.Stop() + { + Console.WriteLine("Запись остановленна"); + } + + void IRecordable.Pause() + { + Console.WriteLine("Запись на паузе"); + } + + void IPlayable.Stop() + { + Console.WriteLine("Проигрывание остановленно"); + } + + void IPlayable.Pause() + { + Console.WriteLine("Проигрывание на паузе"); + } + + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_2/Program.cs b/PisotskiyPavel/Task_4/Task_4_2/Program.cs new file mode 100644 index 0000000..e010db8 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_2/Program.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_4_2 +{ + class Program + { + static void Main(string[] args) + { + Player player = new Player(); + IRecordable recordDevice = player; + IPlayable playerDevice = player; + + recordDevice.Record(); + recordDevice.Pause(); + recordDevice.Stop(); + + playerDevice.Play(); + playerDevice.Pause(); + playerDevice.Stop(); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_4/Task_4_2/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_4/Task_4_2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e6f5148 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_4_2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_4_2")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f12d84b8-230a-47d5-9df9-6bcd1586606f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_4/Task_4_2/Task_4_2.csproj b/PisotskiyPavel/Task_4/Task_4_2/Task_4_2.csproj new file mode 100644 index 0000000..7c9af99 --- /dev/null +++ b/PisotskiyPavel/Task_4/Task_4_2/Task_4_2.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {F12D84B8-230A-47D5-9DF9-6BCD1586606F} + Exe + Properties + Task_4_2 + Task_4_2 + v4.5.2 + 512 + 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 From 7a94c857215e44dcb33e923b4870b06a8b71d589 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Thu, 27 Oct 2016 22:46:48 +0300 Subject: [PATCH 05/12] Task 5 is done --- PisotskiyPavel/Task_5/Task_5.sln | 40 +++++++++++ PisotskiyPavel/Task_5/Task_5_1/App.config | 6 ++ PisotskiyPavel/Task_5/Task_5_1/Calculator.cs | 31 ++++++++ PisotskiyPavel/Task_5/Task_5_1/Program.cs | 70 +++++++++++++++++++ .../Task_5_1/Properties/AssemblyInfo.cs | 36 ++++++++++ .../Task_5/Task_5_1/Task_5_1.csproj | 61 ++++++++++++++++ PisotskiyPavel/Task_5/Task_5_2/App.config | 6 ++ .../Task_5/Task_5_2/ArrayExtensions.cs | 29 ++++++++ PisotskiyPavel/Task_5/Task_5_2/Program.cs | 50 +++++++++++++ .../Task_5_2/Properties/AssemblyInfo.cs | 36 ++++++++++ .../Task_5/Task_5_2/Task_5_2.csproj | 61 ++++++++++++++++ PisotskiyPavel/Task_5/Task_5_3/App.config | 6 ++ .../Task_5/Task_5_3/ArrayExtensions.cs | 31 ++++++++ PisotskiyPavel/Task_5/Task_5_3/Program.cs | 55 +++++++++++++++ .../Task_5_3/Properties/AssemblyInfo.cs | 36 ++++++++++ .../Task_5/Task_5_3/Task_5_3.csproj | 61 ++++++++++++++++ PisotskiyPavel/Task_5/Task_5_4/App.config | 6 ++ PisotskiyPavel/Task_5/Task_5_4/Program.cs | 22 ++++++ .../Task_5_4/Properties/AssemblyInfo.cs | 36 ++++++++++ .../Task_5/Task_5_4/StringExtensions.cs | 67 ++++++++++++++++++ .../Task_5/Task_5_4/Task_5_4.csproj | 61 ++++++++++++++++ 21 files changed, 807 insertions(+) create mode 100644 PisotskiyPavel/Task_5/Task_5.sln create mode 100644 PisotskiyPavel/Task_5/Task_5_1/App.config create mode 100644 PisotskiyPavel/Task_5/Task_5_1/Calculator.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_1/Program.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_1/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_1/Task_5_1.csproj create mode 100644 PisotskiyPavel/Task_5/Task_5_2/App.config create mode 100644 PisotskiyPavel/Task_5/Task_5_2/ArrayExtensions.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_2/Program.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_2/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_2/Task_5_2.csproj create mode 100644 PisotskiyPavel/Task_5/Task_5_3/App.config create mode 100644 PisotskiyPavel/Task_5/Task_5_3/ArrayExtensions.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_3/Program.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_3/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_3/Task_5_3.csproj create mode 100644 PisotskiyPavel/Task_5/Task_5_4/App.config create mode 100644 PisotskiyPavel/Task_5/Task_5_4/Program.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_4/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs create mode 100644 PisotskiyPavel/Task_5/Task_5_4/Task_5_4.csproj diff --git a/PisotskiyPavel/Task_5/Task_5.sln b/PisotskiyPavel/Task_5/Task_5.sln new file mode 100644 index 0000000..9ff78d3 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_5_1", "Task_5_1\Task_5_1.csproj", "{D48C1A78-C0F7-45DA-80FF-3DFB38AACB4C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_5_2", "Task_5_2\Task_5_2.csproj", "{30D76CE0-C432-4F71-890C-F0F005F5AA1B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_5_3", "Task_5_3\Task_5_3.csproj", "{81E1636B-878E-4C20-BD79-BF953DB4A088}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_5_4", "Task_5_4\Task_5_4.csproj", "{88C13547-E535-4176-8290-4309FD3ABED7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D48C1A78-C0F7-45DA-80FF-3DFB38AACB4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D48C1A78-C0F7-45DA-80FF-3DFB38AACB4C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D48C1A78-C0F7-45DA-80FF-3DFB38AACB4C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D48C1A78-C0F7-45DA-80FF-3DFB38AACB4C}.Release|Any CPU.Build.0 = Release|Any CPU + {30D76CE0-C432-4F71-890C-F0F005F5AA1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30D76CE0-C432-4F71-890C-F0F005F5AA1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30D76CE0-C432-4F71-890C-F0F005F5AA1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30D76CE0-C432-4F71-890C-F0F005F5AA1B}.Release|Any CPU.Build.0 = Release|Any CPU + {81E1636B-878E-4C20-BD79-BF953DB4A088}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81E1636B-878E-4C20-BD79-BF953DB4A088}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81E1636B-878E-4C20-BD79-BF953DB4A088}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81E1636B-878E-4C20-BD79-BF953DB4A088}.Release|Any CPU.Build.0 = Release|Any CPU + {88C13547-E535-4176-8290-4309FD3ABED7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88C13547-E535-4176-8290-4309FD3ABED7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88C13547-E535-4176-8290-4309FD3ABED7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88C13547-E535-4176-8290-4309FD3ABED7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PisotskiyPavel/Task_5/Task_5_1/App.config b/PisotskiyPavel/Task_5/Task_5_1/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_5/Task_5_1/Calculator.cs b/PisotskiyPavel/Task_5/Task_5_1/Calculator.cs new file mode 100644 index 0000000..6b45da2 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_1/Calculator.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_1 +{ + static class Calculator + { + public static double Add(double firstValue, double secondValue) + { + return firstValue + secondValue; + } + + public static double Subtract(double firstValue, double secondValue) + { + return firstValue - secondValue; + } + + public static double Multiply(double firstValue, double secondValue) + { + return firstValue * secondValue; + } + + public static double Divide(double firstValue, double secondValue) + { + return firstValue / secondValue; + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_1/Program.cs b/PisotskiyPavel/Task_5/Task_5_1/Program.cs new file mode 100644 index 0000000..8e80572 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_1/Program.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_1 +{ + class Program + { + static void Main(string[] args) + { + while (true) + { + double firstValue = GetNumber("Введите первое значение: "); + double secondValue = GetNumber("Введите второе значение: "); + Console.Write("Выберите операцию над числами (+, -, *, /): "); + string symbol = Console.ReadLine(); + Console.Clear(); + Calculate(firstValue, secondValue, symbol); + Console.WriteLine(); + } + } + + static double GetNumber(string message) + { + Console.Write(message); + double result; + if (!double.TryParse(Console.ReadLine(), out result)) + { + result = GetNumber(message); + } + return result; + } + + static void Calculate(double firstValue, double secondValue, string operation) + { + switch (operation.Trim()) + { + case "+": + Console.WriteLine("{0} + {1} = {2}", firstValue, secondValue, Calculator.Add(firstValue, secondValue)); + break; + + case "-": + Console.WriteLine("{0} - {1} = {2}", firstValue, secondValue, Calculator.Subtract(firstValue, secondValue)); + break; + + case "*": + Console.WriteLine("{0} * {1} = {2}", firstValue, secondValue, Calculator.Multiply(firstValue, secondValue)); + break; + + case "/": + { + try + { + Console.WriteLine("{0} / {1} = {2}", firstValue, secondValue, Calculator.Divide(firstValue, secondValue)); + } + catch (DivideByZeroException ex) + { + Console.WriteLine(ex.Message); + } + } + break; + default: + Console.WriteLine("Данная операция не поддерживается!"); + break; + } + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_1/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_5/Task_5_1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f61ee55 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_5_1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_5_1")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d48c1a78-c0f7-45da-80ff-3dfb38aacb4c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_5/Task_5_1/Task_5_1.csproj b/PisotskiyPavel/Task_5/Task_5_1/Task_5_1.csproj new file mode 100644 index 0000000..783e554 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_1/Task_5_1.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {D48C1A78-C0F7-45DA-80FF-3DFB38AACB4C} + Exe + Properties + Task_5_1 + Task_5_1 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_5/Task_5_2/App.config b/PisotskiyPavel/Task_5/Task_5_2/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_5/Task_5_2/ArrayExtensions.cs b/PisotskiyPavel/Task_5/Task_5_2/ArrayExtensions.cs new file mode 100644 index 0000000..1b61e85 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_2/ArrayExtensions.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_2 +{ + static class ArrayExtensions + { + public static int[] Sort(this int[] array) + { + for (int i = 0; i < array.Length - 1; i++) + { + for (int j = i + 1; j < array.Length; j++) + { + if(array[i].CompareTo(array[j]) > 0) + { + int tempNumber = array[i]; + array[i] = array[j]; + array[j] = tempNumber; + } + } + } + + return array; + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_2/Program.cs b/PisotskiyPavel/Task_5/Task_5_2/Program.cs new file mode 100644 index 0000000..4b91cc9 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_2/Program.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_2 +{ + class Program + { + static void Main(string[] args) + { + int[] array = NumbersGenerator(10, -100, 100); + + Console.WriteLine("До сортировки: "); + Print(array); + + Console.WriteLine(Environment.NewLine); + + Console.WriteLine("После сортировки: "); + Print(array.Sort()); + + Console.ReadLine(); + } + + static void Print(int[] array) + { + for (int i = 0; i < array.Length; i++) + { + Console.Write(array[i]); + if (i != array.Length - 1) + { + Console.Write(" ,"); + } + } + } + + static int[] NumbersGenerator(int arraySize, int minValue, int maxValue) + { + int[] array = new int[arraySize]; + Random rand = new Random((int)DateTime.Now.Ticks); + for (int i = 0; i < arraySize; i++) + { + array[i] = rand.Next(minValue, maxValue + 1); + } + + return array; + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_2/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_5/Task_5_2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ab25182 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_5_2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_5_2")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("30d76ce0-c432-4f71-890c-f0f005f5aa1b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_5/Task_5_2/Task_5_2.csproj b/PisotskiyPavel/Task_5/Task_5_2/Task_5_2.csproj new file mode 100644 index 0000000..d18a57f --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_2/Task_5_2.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {30D76CE0-C432-4F71-890C-F0F005F5AA1B} + Exe + Properties + Task_5_2 + Task_5_2 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_5/Task_5_3/App.config b/PisotskiyPavel/Task_5/Task_5_3/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_3/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_5/Task_5_3/ArrayExtensions.cs b/PisotskiyPavel/Task_5/Task_5_3/ArrayExtensions.cs new file mode 100644 index 0000000..62ab3d9 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_3/ArrayExtensions.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_3 +{ + static class ArrayExtensions + { + public static int[] Sort(this int[] array, bool isAscending = true) + { + int modificator = isAscending ? 1 : -1; + + for (int i = 0; i < array.Length - 1; i++) + { + for (int j = i + 1; j < array.Length; j++) + { + if(array[i].CompareTo(array[j]) * modificator > 0) + { + int tempNumber = array[i]; + array[i] = array[j]; + array[j] = tempNumber; + } + } + } + + return array; + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_3/Program.cs b/PisotskiyPavel/Task_5/Task_5_3/Program.cs new file mode 100644 index 0000000..d55f07c --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_3/Program.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_3 +{ + class Program + { + static void Main(string[] args) + { + int[] array = NumbersGenerator(10, -100, 100); + + Console.WriteLine("До сортировки: "); + Print(array); + + Console.WriteLine(Environment.NewLine); + + Console.WriteLine("После сортировки по возрастанию: "); + Print(array.Sort()); + + Console.WriteLine(Environment.NewLine); + + Console.WriteLine("После сортировки по убыванию: "); + Print(array.Sort(false)); + + Console.ReadLine(); + } + + static void Print(int[] array) + { + for (int i = 0; i < array.Length; i++) + { + Console.Write(array[i]); + if (i != array.Length - 1) + { + Console.Write(" ,"); + } + } + } + + static int[] NumbersGenerator(int arraySize, int minValue, int maxValue) + { + int[] array = new int[arraySize]; + Random rand = new Random((int)DateTime.Now.Ticks); + for (int i = 0; i < arraySize; i++) + { + array[i] = rand.Next(minValue, maxValue + 1); + } + + return array; + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_3/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_5/Task_5_3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..954c00e --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_3/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_5_3")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_5_3")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("81e1636b-878e-4c20-bd79-bf953db4a088")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_5/Task_5_3/Task_5_3.csproj b/PisotskiyPavel/Task_5/Task_5_3/Task_5_3.csproj new file mode 100644 index 0000000..4b750ea --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_3/Task_5_3.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {81E1636B-878E-4C20-BD79-BF953DB4A088} + Exe + Properties + Task_5_3 + Task_5_3 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_5/Task_5_4/App.config b/PisotskiyPavel/Task_5/Task_5_4/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_4/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_5/Task_5_4/Program.cs b/PisotskiyPavel/Task_5/Task_5_4/Program.cs new file mode 100644 index 0000000..8ec62d2 --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_4/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_4 +{ + class Program + { + static void Main(string[] args) + { + string str = "H_e_l_l_o W_o_r_l_d!!!"; + Console.WriteLine("Слово: {0}{1}", str, Environment.NewLine); + Console.WriteLine("Индекс знака {0}: {1}", "'W'", StringExtensions.IndexOf(str, "W")); + Console.WriteLine(StringExtensions.Replace(str, "_", "")); + Console.WriteLine(StringExtensions.Substring(str, str.Length - 12, 9)); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_4/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_5/Task_5_4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..253032f --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_5_4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_5_4")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("88c13547-e535-4176-8290-4309fd3abed7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs new file mode 100644 index 0000000..321c9eb --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_5_4 +{ + static class StringExtensions + { + public static string Substring(this string value, int startIndex, int lenght) + { + string result = string.Empty; + + for (int i = startIndex; i < startIndex + lenght; i++) + { + result += value[i]; + } + + return result; + } + + public static int IndexOf(this string str, string value) + { + int index = -1; + + if (value.Equals(string.Empty)) + { + return 0; + } + + for (int i = 0; i < str.Length - value.Length; i++) + { + string substring = Substring(str, i, value.Length); + if (substring.Contains(value)) + { + index = i; + break; + } + + } + + return index; + } + + public static string Replace(this string value, string oldValue, string newValue) + { + if (oldValue.Equals(string.Empty)) + return value; + + for (int i = 0; i < value.Length - oldValue.Length + 1; i++) + { + string substring = Substring(value, i, oldValue.Length); + + if (substring.Contains(oldValue)) + { + string start = value.Substring(0, i); + string end = value.Substring((oldValue.Length + i), value.Length - start.Length - oldValue.Length); + value = start + newValue + end; + } + + } + + return value; + } + } +} diff --git a/PisotskiyPavel/Task_5/Task_5_4/Task_5_4.csproj b/PisotskiyPavel/Task_5/Task_5_4/Task_5_4.csproj new file mode 100644 index 0000000..b6867ff --- /dev/null +++ b/PisotskiyPavel/Task_5/Task_5_4/Task_5_4.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {88C13547-E535-4176-8290-4309FD3ABED7} + Exe + Properties + Task_5_4 + Task_5_4 + v4.5.2 + 512 + 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 From a98f75ba002c636b7d0123e12ed62fd0e53b7c13 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Thu, 27 Oct 2016 23:07:41 +0300 Subject: [PATCH 06/12] Bug fix --- PisotskiyPavel/Task_5/Task_5_4/Program.cs | 1 + PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/PisotskiyPavel/Task_5/Task_5_4/Program.cs b/PisotskiyPavel/Task_5/Task_5_4/Program.cs index 8ec62d2..c3de065 100644 --- a/PisotskiyPavel/Task_5/Task_5_4/Program.cs +++ b/PisotskiyPavel/Task_5/Task_5_4/Program.cs @@ -13,6 +13,7 @@ static void Main(string[] args) string str = "H_e_l_l_o W_o_r_l_d!!!"; Console.WriteLine("Слово: {0}{1}", str, Environment.NewLine); Console.WriteLine("Индекс знака {0}: {1}", "'W'", StringExtensions.IndexOf(str, "W")); + Console.WriteLine(StringExtensions.Replace(str, "_", "___")); Console.WriteLine(StringExtensions.Replace(str, "_", "")); Console.WriteLine(StringExtensions.Substring(str, str.Length - 12, 9)); diff --git a/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs index 321c9eb..e98b518 100644 --- a/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs +++ b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs @@ -57,6 +57,10 @@ public static string Replace(this string value, string oldValue, string newValue string start = value.Substring(0, i); string end = value.Substring((oldValue.Length + i), value.Length - start.Length - oldValue.Length); value = start + newValue + end; + if(newValue.Length > oldValue.Length) + { + i += newValue.Length - oldValue.Length; + } } } From 6f9ad95816edb093a7b4fb0a2d4a0c8344d04be5 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Thu, 27 Oct 2016 23:13:25 +0300 Subject: [PATCH 07/12] Bug fix --- PisotskiyPavel/Task_5/Task_5_4/Program.cs | 6 +++--- PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/PisotskiyPavel/Task_5/Task_5_4/Program.cs b/PisotskiyPavel/Task_5/Task_5_4/Program.cs index c3de065..ce7a4c4 100644 --- a/PisotskiyPavel/Task_5/Task_5_4/Program.cs +++ b/PisotskiyPavel/Task_5/Task_5_4/Program.cs @@ -10,11 +10,11 @@ class Program { static void Main(string[] args) { - string str = "H_e_l_l_o W_o_r_l_d!!!"; + string str = "H__e__l_l_o W_o_r_l_d!!!"; Console.WriteLine("Слово: {0}{1}", str, Environment.NewLine); Console.WriteLine("Индекс знака {0}: {1}", "'W'", StringExtensions.IndexOf(str, "W")); - Console.WriteLine(StringExtensions.Replace(str, "_", "___")); - Console.WriteLine(StringExtensions.Replace(str, "_", "")); + //Console.WriteLine(StringExtensions.Replace(str, "_", "___")); + Console.WriteLine(StringExtensions.Replace(str, "__", "_")); Console.WriteLine(StringExtensions.Substring(str, str.Length - 12, 9)); Console.ReadLine(); diff --git a/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs index e98b518..9783518 100644 --- a/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs +++ b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs @@ -61,6 +61,10 @@ public static string Replace(this string value, string oldValue, string newValue { i += newValue.Length - oldValue.Length; } + else if(newValue.Length < oldValue.Length) + { + i -= oldValue.Length - newValue.Length; + } } } From d044bdac8ac5a3ac676f9d9bb4187f97a6d17883 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Thu, 27 Oct 2016 23:16:22 +0300 Subject: [PATCH 08/12] Added test cases --- PisotskiyPavel/Task_5/Task_5_4/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PisotskiyPavel/Task_5/Task_5_4/Program.cs b/PisotskiyPavel/Task_5/Task_5_4/Program.cs index ce7a4c4..59496b0 100644 --- a/PisotskiyPavel/Task_5/Task_5_4/Program.cs +++ b/PisotskiyPavel/Task_5/Task_5_4/Program.cs @@ -13,8 +13,9 @@ static void Main(string[] args) string str = "H__e__l_l_o W_o_r_l_d!!!"; Console.WriteLine("Слово: {0}{1}", str, Environment.NewLine); Console.WriteLine("Индекс знака {0}: {1}", "'W'", StringExtensions.IndexOf(str, "W")); - //Console.WriteLine(StringExtensions.Replace(str, "_", "___")); + Console.WriteLine(StringExtensions.Replace(str, "_", "___")); Console.WriteLine(StringExtensions.Replace(str, "__", "_")); + Console.WriteLine(StringExtensions.Replace(str, "_", "")); Console.WriteLine(StringExtensions.Substring(str, str.Length - 12, 9)); Console.ReadLine(); From 735f5ef7721c2e4db38c512551f78d88b0b325d4 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Fri, 28 Oct 2016 19:22:03 +0300 Subject: [PATCH 09/12] Changed 'Replace' method --- PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs index 9783518..7b7cce4 100644 --- a/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs +++ b/PisotskiyPavel/Task_5/Task_5_4/StringExtensions.cs @@ -32,7 +32,7 @@ public static int IndexOf(this string str, string value) for (int i = 0; i < str.Length - value.Length; i++) { string substring = Substring(str, i, value.Length); - if (substring.Contains(value)) + if (substring.Equals(value)) { index = i; break; @@ -52,7 +52,7 @@ public static string Replace(this string value, string oldValue, string newValue { string substring = Substring(value, i, oldValue.Length); - if (substring.Contains(oldValue)) + if (substring.Equals(oldValue)) { string start = value.Substring(0, i); string end = value.Substring((oldValue.Length + i), value.Length - start.Length - oldValue.Length); @@ -64,6 +64,9 @@ public static string Replace(this string value, string oldValue, string newValue else if(newValue.Length < oldValue.Length) { i -= oldValue.Length - newValue.Length; + }else + { + i += newValue.Length; } } From ded856ba6c6c9c3a5e1a0b09afa70778b35d43c8 Mon Sep 17 00:00:00 2001 From: PavelPisotskiy Date: Fri, 28 Oct 2016 21:47:09 +0300 Subject: [PATCH 10/12] Task 6 is done --- PisotskiyPavel/Task_6/Task_6.sln | 52 ++++++++ PisotskiyPavel/Task_6/Task_6_1/App.config | 6 + PisotskiyPavel/Task_6/Task_6_1/Notebook.cs | 29 +++++ PisotskiyPavel/Task_6/Task_6_1/Program.cs | 19 +++ .../Task_6_1/Properties/AssemblyInfo.cs | 36 ++++++ .../Task_6/Task_6_1/Task_6_1.csproj | 61 +++++++++ PisotskiyPavel/Task_6/Task_6_2/App.config | 6 + PisotskiyPavel/Task_6/Task_6_2/Program.cs | 116 ++++++++++++++++++ .../Task_6_2/Properties/AssemblyInfo.cs | 36 ++++++ .../Task_6/Task_6_2/Task_6_2.csproj | 61 +++++++++ PisotskiyPavel/Task_6/Task_6_2/Train.cs | 34 +++++ PisotskiyPavel/Task_6/Task_6_3/App.config | 6 + PisotskiyPavel/Task_6/Task_6_3/MyClass.cs | 13 ++ PisotskiyPavel/Task_6/Task_6_3/MyStruct.cs | 13 ++ PisotskiyPavel/Task_6/Task_6_3/Program.cs | 35 ++++++ .../Task_6_3/Properties/AssemblyInfo.cs | 36 ++++++ .../Task_6/Task_6_3/Task_6_3.csproj | 62 ++++++++++ PisotskiyPavel/Task_6/Task_6_4/App.config | 6 + PisotskiyPavel/Task_6/Task_6_4/Program.cs | 48 ++++++++ .../Task_6_4/Properties/AssemblyInfo.cs | 36 ++++++ .../Task_6/Task_6_4/Task_6_4.csproj | 60 +++++++++ PisotskiyPavel/Task_6/Task_6_5/App.config | 6 + PisotskiyPavel/Task_6/Task_6_5/Colors.cs | 16 +++ PisotskiyPavel/Task_6/Task_6_5/Printer.cs | 35 ++++++ PisotskiyPavel/Task_6/Task_6_5/Program.cs | 51 ++++++++ .../Task_6_5/Properties/AssemblyInfo.cs | 36 ++++++ .../Task_6/Task_6_5/Task_6_5.csproj | 62 ++++++++++ PisotskiyPavel/Task_6/Task_6_6/Accountant.cs | 16 +++ PisotskiyPavel/Task_6/Task_6_6/App.config | 6 + PisotskiyPavel/Task_6/Task_6_6/Post.cs | 15 +++ PisotskiyPavel/Task_6/Task_6_6/Program.cs | 22 ++++ .../Task_6_6/Properties/AssemblyInfo.cs | 36 ++++++ .../Task_6/Task_6_6/Task_6_6.csproj | 62 ++++++++++ 33 files changed, 1134 insertions(+) create mode 100644 PisotskiyPavel/Task_6/Task_6.sln create mode 100644 PisotskiyPavel/Task_6/Task_6_1/App.config create mode 100644 PisotskiyPavel/Task_6/Task_6_1/Notebook.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_1/Program.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_1/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_1/Task_6_1.csproj create mode 100644 PisotskiyPavel/Task_6/Task_6_2/App.config create mode 100644 PisotskiyPavel/Task_6/Task_6_2/Program.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_2/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_2/Task_6_2.csproj create mode 100644 PisotskiyPavel/Task_6/Task_6_2/Train.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_3/App.config create mode 100644 PisotskiyPavel/Task_6/Task_6_3/MyClass.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_3/MyStruct.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_3/Program.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_3/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_3/Task_6_3.csproj create mode 100644 PisotskiyPavel/Task_6/Task_6_4/App.config create mode 100644 PisotskiyPavel/Task_6/Task_6_4/Program.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_4/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_4/Task_6_4.csproj create mode 100644 PisotskiyPavel/Task_6/Task_6_5/App.config create mode 100644 PisotskiyPavel/Task_6/Task_6_5/Colors.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_5/Printer.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_5/Program.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_5/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_5/Task_6_5.csproj create mode 100644 PisotskiyPavel/Task_6/Task_6_6/Accountant.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_6/App.config create mode 100644 PisotskiyPavel/Task_6/Task_6_6/Post.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_6/Program.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_6/Properties/AssemblyInfo.cs create mode 100644 PisotskiyPavel/Task_6/Task_6_6/Task_6_6.csproj diff --git a/PisotskiyPavel/Task_6/Task_6.sln b/PisotskiyPavel/Task_6/Task_6.sln new file mode 100644 index 0000000..6d34bdc --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_6_1", "Task_6_1\Task_6_1.csproj", "{1503406B-6C32-4A92-895A-0090E5922B48}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_6_2", "Task_6_2\Task_6_2.csproj", "{998AE3DC-32B0-436E-8B97-8B4B2377CBF7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_6_3", "Task_6_3\Task_6_3.csproj", "{5BA70FA8-63E4-402F-BF7D-540D639E9B03}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_6_4", "Task_6_4\Task_6_4.csproj", "{40D3BFF5-F97F-435F-A62B-E363A3059A98}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_6_5", "Task_6_5\Task_6_5.csproj", "{DD4BB0AE-7BCA-47E0-BB50-DEB160E716A2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task_6_6", "Task_6_6\Task_6_6.csproj", "{D6F5ECD9-DE67-43E1-BAA1-5AEF8C9A71F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1503406B-6C32-4A92-895A-0090E5922B48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1503406B-6C32-4A92-895A-0090E5922B48}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1503406B-6C32-4A92-895A-0090E5922B48}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1503406B-6C32-4A92-895A-0090E5922B48}.Release|Any CPU.Build.0 = Release|Any CPU + {998AE3DC-32B0-436E-8B97-8B4B2377CBF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {998AE3DC-32B0-436E-8B97-8B4B2377CBF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {998AE3DC-32B0-436E-8B97-8B4B2377CBF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {998AE3DC-32B0-436E-8B97-8B4B2377CBF7}.Release|Any CPU.Build.0 = Release|Any CPU + {5BA70FA8-63E4-402F-BF7D-540D639E9B03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BA70FA8-63E4-402F-BF7D-540D639E9B03}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BA70FA8-63E4-402F-BF7D-540D639E9B03}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BA70FA8-63E4-402F-BF7D-540D639E9B03}.Release|Any CPU.Build.0 = Release|Any CPU + {40D3BFF5-F97F-435F-A62B-E363A3059A98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40D3BFF5-F97F-435F-A62B-E363A3059A98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40D3BFF5-F97F-435F-A62B-E363A3059A98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40D3BFF5-F97F-435F-A62B-E363A3059A98}.Release|Any CPU.Build.0 = Release|Any CPU + {DD4BB0AE-7BCA-47E0-BB50-DEB160E716A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD4BB0AE-7BCA-47E0-BB50-DEB160E716A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD4BB0AE-7BCA-47E0-BB50-DEB160E716A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD4BB0AE-7BCA-47E0-BB50-DEB160E716A2}.Release|Any CPU.Build.0 = Release|Any CPU + {D6F5ECD9-DE67-43E1-BAA1-5AEF8C9A71F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6F5ECD9-DE67-43E1-BAA1-5AEF8C9A71F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6F5ECD9-DE67-43E1-BAA1-5AEF8C9A71F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6F5ECD9-DE67-43E1-BAA1-5AEF8C9A71F7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/PisotskiyPavel/Task_6/Task_6_1/App.config b/PisotskiyPavel/Task_6/Task_6_1/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_6/Task_6_1/Notebook.cs b/PisotskiyPavel/Task_6/Task_6_1/Notebook.cs new file mode 100644 index 0000000..ae6cf25 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_1/Notebook.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_1 +{ + struct Notebook + { + public string Model { get; set; } + public string Manufacturer { get; set; } + public double Price { get; set; } + + public Notebook(string model, string manufacturer, double price) + { + Model = model; + Manufacturer = manufacturer; + Price = price; + } + + public void PrintInfo() + { + Console.WriteLine("Модель: {0}", Model); + Console.WriteLine("Производитель: {0}", Manufacturer); + Console.WriteLine("Цена: {0}$", Price); + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_1/Program.cs b/PisotskiyPavel/Task_6/Task_6_1/Program.cs new file mode 100644 index 0000000..5a18626 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_1/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_1 +{ + class Program + { + static void Main(string[] args) + { + Notebook notebook = new Notebook("Microsoft Surface Book i7", "Microsoft", 2400); + notebook.PrintInfo(); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_1/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_6/Task_6_1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0c7c48c --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_6_1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_6_1")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1503406b-6c32-4a92-895a-0090e5922b48")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_6/Task_6_1/Task_6_1.csproj b/PisotskiyPavel/Task_6/Task_6_1/Task_6_1.csproj new file mode 100644 index 0000000..dc59548 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_1/Task_6_1.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {1503406B-6C32-4A92-895A-0090E5922B48} + Exe + Properties + Task_6_1 + Task_6_1 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_6/Task_6_2/App.config b/PisotskiyPavel/Task_6/Task_6_2/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_6/Task_6_2/Program.cs b/PisotskiyPavel/Task_6/Task_6_2/Program.cs new file mode 100644 index 0000000..816ecdf --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_2/Program.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_2 +{ + class Program + { + static void Main(string[] args) + { + List trains = new List(); + int trainsNumber = 2; + + + while (trains.Count < trainsNumber ) + { + Console.WriteLine("Поезд №{0}:", trains.Count + 1); + AddTrain(trains); + Console.WriteLine(new string('-', Console.BufferWidth - 1)); + } + + Console.Clear(); + + trains.Sort(); + + while (true) + { + int trainNumber = GetInteger("Для вывода информации о поезде, введите его номер: "); + int index = trains.FindIndex(t => t.TrainNumber == trainNumber); + + if(index == -1) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Информация о данном поезде не найденна:"); + Console.ResetColor(); + } + else + { + trains[index].PrintInfo(); + } + Console.WriteLine(new string('-', Console.BufferWidth - 1)); + } + + } + + static void AddTrain(ICollection trains) + { + int trainNumber = EnterTrainNumber(); + string destination = EnterDestination(); + DateTime departureTime = EnterDepartureTime(); + + trains.Add(new Train() + { + TrainNumber = trainNumber, + Destination = destination, + DepartureTime = departureTime + }); + } + + + + private static int EnterTrainNumber() + { + return GetInteger("Введите номер поезда: "); + } + + private static int GetInteger(string message) + { + Console.Write(message); + string num = Console.ReadLine(); + + int result; + if (!int.TryParse(num, out result)) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Вы ввели не корректные данные!"); + Console.ResetColor(); + return EnterTrainNumber(); + } + return result; + } + + private static string EnterDestination() + { + Console.Write("Введите название пункта назначения: "); + string destination = Console.ReadLine(); + if (destination.Equals(string.Empty)) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Вы ввели не корректные данные!"); + Console.ResetColor(); + return EnterDestination(); + } + + return destination; + } + + private static DateTime EnterDepartureTime() + { + Console.Write("Введите время отправления: "); + string time = Console.ReadLine(); + DateTime result; + if (!DateTime.TryParse(time, out result)) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Вы ввели не корректные данные!"); + Console.ResetColor(); + return EnterDepartureTime(); + } + + return result; + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_2/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_6/Task_6_2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6897e13 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_6_2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_6_2")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("998ae3dc-32b0-436e-8b97-8b4b2377cbf7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_6/Task_6_2/Task_6_2.csproj b/PisotskiyPavel/Task_6/Task_6_2/Task_6_2.csproj new file mode 100644 index 0000000..7dfc721 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_2/Task_6_2.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {998AE3DC-32B0-436E-8B97-8B4B2377CBF7} + Exe + Properties + Task_6_2 + Task_6_2 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_6/Task_6_2/Train.cs b/PisotskiyPavel/Task_6/Task_6_2/Train.cs new file mode 100644 index 0000000..de72703 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_2/Train.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_2 +{ + struct Train : IComparable + { + public string Destination { get; set; } + public int TrainNumber { get; set; } + public DateTime DepartureTime { get; set; } + + public Train(int trainNumber, string destination, DateTime departureTime) + { + Destination = destination; + TrainNumber = trainNumber; + DepartureTime = departureTime; + } + + public int CompareTo(Train other) + { + return this.TrainNumber.CompareTo(other.TrainNumber); + } + + public void PrintInfo() + { + Console.WriteLine("Номер поезда: {0}", TrainNumber); + Console.WriteLine("Название пункта назначения: {0}", Destination); + Console.WriteLine("Время отправления: {0}", DepartureTime); + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_3/App.config b/PisotskiyPavel/Task_6/Task_6_3/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_3/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_6/Task_6_3/MyClass.cs b/PisotskiyPavel/Task_6/Task_6_3/MyClass.cs new file mode 100644 index 0000000..df8aa78 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_3/MyClass.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_3 +{ + class MyClass + { + public string change; + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_3/MyStruct.cs b/PisotskiyPavel/Task_6/Task_6_3/MyStruct.cs new file mode 100644 index 0000000..9309e54 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_3/MyStruct.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_3 +{ + struct MyStruct + { + public string change; + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_3/Program.cs b/PisotskiyPavel/Task_6/Task_6_3/Program.cs new file mode 100644 index 0000000..c4d15c8 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_3/Program.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_3 +{ + class Program + { + static void Main(string[] args) + { + MyClass myClass = new MyClass() { change = "Не изменено" }; + MyStruct myStruct = new MyStruct() { change = "Не изменено" }; + + ClassTaker(myClass); + StructTaker(myStruct); + + Console.WriteLine("{0} - {1}", myClass.GetType().Name, myClass.change); + Console.WriteLine("{0} - {1}", myStruct.GetType().Name, myStruct.change); + + Console.ReadLine(); + } + + private static void ClassTaker(MyClass myClass) + { + myClass.change = "изменено"; + } + + private static void StructTaker(MyStruct myStruct) + { + myStruct.change = "изменено"; + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_3/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_6/Task_6_3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..750566b --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_3/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_6_3")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_6_3")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5ba70fa8-63e4-402f-bf7d-540d639e9b03")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_6/Task_6_3/Task_6_3.csproj b/PisotskiyPavel/Task_6/Task_6_3/Task_6_3.csproj new file mode 100644 index 0000000..a4e513d --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_3/Task_6_3.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {5BA70FA8-63E4-402F-BF7D-540D639E9B03} + Exe + Properties + Task_6_3 + Task_6_3 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_6/Task_6_4/App.config b/PisotskiyPavel/Task_6/Task_6_4/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_4/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_6/Task_6_4/Program.cs b/PisotskiyPavel/Task_6/Task_6_4/Program.cs new file mode 100644 index 0000000..943b3a3 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_4/Program.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_4 +{ + class Program + { + static void Main(string[] args) + { + DateTime birthDay = EnterBirthDay(); + Console.WriteLine("До дня рождения осталось: {0} дней", DaysToBirthDay(birthDay)); + Console.ReadLine(); + } + + static int DaysToBirthDay(DateTime birthDay) + { + DateTime now = DateTime.Now; + DateTime birthDayInCurrentYear = new DateTime(now.Year, birthDay.Month, birthDay.Day); + + if (now > birthDayInCurrentYear) + { + DateTime birthDayInNextYear = birthDayInCurrentYear.AddYears(1); + return (int)(birthDayInNextYear - now).TotalDays; + } + + return (int)(now - birthDayInCurrentYear).TotalDays; + } + + private static DateTime EnterBirthDay() + { + Console.Write("Введите дату своего рождения: "); + string time = Console.ReadLine(); + DateTime result; + if (!DateTime.TryParse(time, out result)) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Вы ввели не корректные данные!"); + Console.ResetColor(); + return EnterBirthDay(); + } + + return result; + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_4/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_6/Task_6_4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..caf94da --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_6_4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_6_4")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("40d3bff5-f97f-435f-a62b-e363a3059a98")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_6/Task_6_4/Task_6_4.csproj b/PisotskiyPavel/Task_6/Task_6_4/Task_6_4.csproj new file mode 100644 index 0000000..c940c51 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_4/Task_6_4.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {40D3BFF5-F97F-435F-A62B-E363A3059A98} + Exe + Properties + Task_6_4 + Task_6_4 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_6/Task_6_5/App.config b/PisotskiyPavel/Task_6/Task_6_5/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_5/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_6/Task_6_5/Colors.cs b/PisotskiyPavel/Task_6/Task_6_5/Colors.cs new file mode 100644 index 0000000..41742da --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_5/Colors.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_5 +{ + public enum Colors + { + Red, + Yellow, + Green, + Blue + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_5/Printer.cs b/PisotskiyPavel/Task_6/Task_6_5/Printer.cs new file mode 100644 index 0000000..6d0c669 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_5/Printer.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_5 +{ + static class Printer + { + public static void Print(string text, int color) + { + Console.ForegroundColor = GetConsoleColor((Colors)color); + Console.WriteLine(text); + Console.ResetColor(); + } + + private static ConsoleColor GetConsoleColor(Colors colors) + { + switch (colors) + { + case Colors.Red: + return ConsoleColor.Red; + case Colors.Yellow: + return ConsoleColor.Yellow; + case Colors.Green: + return ConsoleColor.Green; + case Colors.Blue: + return ConsoleColor.Blue; + default: + return ConsoleColor.Gray; + } + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_5/Program.cs b/PisotskiyPavel/Task_6/Task_6_5/Program.cs new file mode 100644 index 0000000..f103b29 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_5/Program.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_5 +{ + class Program + { + static void Main(string[] args) + { + Console.Write("Выберите цвет: "); + foreach (var value in Enum.GetValues(typeof(Colors))) + { + Console.ForegroundColor = GetConsoleColor((Colors)value); + Console.Write("{0} ", (int)value); + Console.ResetColor(); + } + + Console.Write("{0}Введите номер цвета: ", Environment.NewLine); + + int color = Convert.ToInt32(Console.ReadLine()); + + Console.Write("Введите текст: "); + string text = Console.ReadLine(); + + Console.Write("Результат: "); + Printer.Print(text, color); + + Console.ReadLine(); + } + + private static ConsoleColor GetConsoleColor(Colors colors) + { + switch (colors) + { + case Colors.Red: + return ConsoleColor.Red; + case Colors.Yellow: + return ConsoleColor.Yellow; + case Colors.Green: + return ConsoleColor.Green; + case Colors.Blue: + return ConsoleColor.Blue; + default: + return ConsoleColor.Gray; + } + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_5/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_6/Task_6_5/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7667f2c --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_5/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_6_5")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_6_5")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("dd4bb0ae-7bca-47e0-bb50-deb160e716a2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_6/Task_6_5/Task_6_5.csproj b/PisotskiyPavel/Task_6/Task_6_5/Task_6_5.csproj new file mode 100644 index 0000000..a974b39 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_5/Task_6_5.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {DD4BB0AE-7BCA-47E0-BB50-DEB160E716A2} + Exe + Properties + Task_6_5 + Task_6_5 + v4.5.2 + 512 + 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/PisotskiyPavel/Task_6/Task_6_6/Accountant.cs b/PisotskiyPavel/Task_6/Task_6_6/Accountant.cs new file mode 100644 index 0000000..89afcdd --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_6/Accountant.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_6 +{ + class Accountant + { + public bool AskForBonus(Post post, int hours) + { + return hours > (int)post; + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_6/App.config b/PisotskiyPavel/Task_6/Task_6_6/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_6/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PisotskiyPavel/Task_6/Task_6_6/Post.cs b/PisotskiyPavel/Task_6/Task_6_6/Post.cs new file mode 100644 index 0000000..3b1c395 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_6/Post.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_6 +{ + enum Post + { + Director = 160, + Manager = 150, + Programmer = 145 + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_6/Program.cs b/PisotskiyPavel/Task_6/Task_6_6/Program.cs new file mode 100644 index 0000000..a13fc29 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_6/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_6_6 +{ + class Program + { + static void Main(string[] args) + { + Post post = Post.Director; + int hours = 170; + Console.WriteLine("{0} отработал {1} часов", post, hours); + Accountant acc = new Accountant(); + Console.Write("Положена ли премия? {0}", acc.AskForBonus(post, hours) ? "Да" : "Нет"); + + Console.ReadLine(); + } + } +} diff --git a/PisotskiyPavel/Task_6/Task_6_6/Properties/AssemblyInfo.cs b/PisotskiyPavel/Task_6/Task_6_6/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2e9a0c0 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_6/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Task_6_6")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Task_6_6")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d6f5ecd9-de67-43e1-baa1-5aef8c9a71f7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PisotskiyPavel/Task_6/Task_6_6/Task_6_6.csproj b/PisotskiyPavel/Task_6/Task_6_6/Task_6_6.csproj new file mode 100644 index 0000000..d92dbc7 --- /dev/null +++ b/PisotskiyPavel/Task_6/Task_6_6/Task_6_6.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {D6F5ECD9-DE67-43E1-BAA1-5AEF8C9A71F7} + Exe + Properties + Task_6_6 + Task_6_6 + v4.5.2 + 512 + 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 From 907a1e441a9afae7fa8d5186b6657d093a69ab1e Mon Sep 17 00:00:00 2001 From: Ivan Pugach Date: Sun, 20 Nov 2016 17:48:52 +0200 Subject: [PATCH 11/12] Task_1 --- Ivan_Pugach/Task-1.sln | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Ivan_Pugach/Task-1.sln diff --git a/Ivan_Pugach/Task-1.sln b/Ivan_Pugach/Task-1.sln new file mode 100644 index 0000000..6af448b --- /dev/null +++ b/Ivan_Pugach/Task-1.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task-1", "Task-1\Task-1.csproj", "{520E81E7-A343-4CA3-A81E-1E215B8834A0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {520E81E7-A343-4CA3-A81E-1E215B8834A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {520E81E7-A343-4CA3-A81E-1E215B8834A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {520E81E7-A343-4CA3-A81E-1E215B8834A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {520E81E7-A343-4CA3-A81E-1E215B8834A0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From 5874887a90cdd11a64a65de36d76240ece4e1397 Mon Sep 17 00:00:00 2001 From: Ivan Pugach Date: Sun, 20 Nov 2016 17:55:24 +0200 Subject: [PATCH 12/12] Task_1 --- Ivan_Pugach/Task-1/App.config | 6 + Ivan_Pugach/Task-1/Program.cs | 234 ++++++++++++++++++ Ivan_Pugach/Task-1/Properties/AssemblyInfo.cs | 36 +++ Ivan_Pugach/Task-1/Task-1.csproj | 60 +++++ 4 files changed, 336 insertions(+) create mode 100644 Ivan_Pugach/Task-1/App.config create mode 100644 Ivan_Pugach/Task-1/Program.cs create mode 100644 Ivan_Pugach/Task-1/Properties/AssemblyInfo.cs create mode 100644 Ivan_Pugach/Task-1/Task-1.csproj diff --git a/Ivan_Pugach/Task-1/App.config b/Ivan_Pugach/Task-1/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/Ivan_Pugach/Task-1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Ivan_Pugach/Task-1/Program.cs b/Ivan_Pugach/Task-1/Program.cs new file mode 100644 index 0000000..901e4e6 --- /dev/null +++ b/Ivan_Pugach/Task-1/Program.cs @@ -0,0 +1,234 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Task_1 +{ + enum Days + { + Понедельник=1, + Вторник, + Среда, + Четверг, + Пятница, + Суббота, + Воскресенье + }; + class Program + { + public static string inputBuffer() + { + string input = Console.ReadLine(); + return input; + } + + public static void displayMyName() + { + string delimiter = "+---------------------------------+"; + Console.WriteLine("{0}\n {1} {2} {3}\n{4}", delimiter, "Pugach", "Ivan", "Stanislavovhich", delimiter); + Console.ReadKey(); + Console.Clear(); + } + + public static void Task_1_1() + { + Console.WriteLine("Task 1, input first number"); + int firstNumber = Convert.ToInt16(inputBuffer()); + + Console.WriteLine("input second number"); + int secondNumber = Convert.ToInt16(inputBuffer()); + + Console.WriteLine("result"); + Console.WriteLine(firstNumber + secondNumber); + } + + public static void Task_1_2() + { + Console.WriteLine("Task 2 \ninput мяу or гав"); + + string buff = inputBuffer(); + + if (buff == "мяу") Console.WriteLine("Покорма кота"); + + else if (buff == "гав") Console.WriteLine("Погуляй с собакой"); + + else Console.WriteLine("wrong input"); + } + + public static void Task_1_3() + { + Console.WriteLine("Task 3 \ninput the number of months"); + int numberOfTheMonth= Convert.ToInt16(inputBuffer()); + + if (numberOfTheMonth >= 3 && numberOfTheMonth <= 5) Console.WriteLine("Весна"); + + else if (numberOfTheMonth >= 6 && numberOfTheMonth <= 8) Console.WriteLine("Лето"); + else if (numberOfTheMonth >= 9 && numberOfTheMonth <= 11) Console.WriteLine("Осень"); + else if (numberOfTheMonth == 1 || numberOfTheMonth == 2 || numberOfTheMonth == 12) Console.WriteLine("Зима"); + else Console.WriteLine("На этой планете такого месяца нет"); + } + + public static void Task_1_4() + { + Console.WriteLine("Task 4 \ninput 0 or 1"); + int inputNumber= Convert.ToInt16(inputBuffer()); + + Console.WriteLine("{0}", (inputNumber == 0) ? "Плохо" : "Хорошо"); + } + public static void Task_1_5() + { + Console.Write("Task 5 \ninput the number : "); + int number =Convert.ToInt16(inputBuffer()); + + Console.WriteLine("{0}", (Days)number); + } + + public static void Task_1_6() + { + Console.WriteLine("number of kilometers?"); + double numberOfKilometers = Convert.ToDouble(inputBuffer()); + Console.WriteLine("downtime ?"); + double numberOfMinutes = Convert.ToDouble(inputBuffer()); + Console.WriteLine("sum to pay is {0}", (numberOfKilometers <= 5) ? 20 + numberOfMinutes : 20 + (numberOfKilometers - 5) * 3 + numberOfMinutes); + } + public static void Task_1_7() + { + bool isPrime=true; + Console.WriteLine("Task 7 \nnumber?"); + int inputNumber = Convert.ToInt16(inputBuffer()); + for(int i=2; i<=Math.Sqrt(inputNumber);i++) + { + if (inputNumber % i == 0) { isPrime=false; break; } + } + if (isPrime) Console.WriteLine("prime"); + else Console.WriteLine("not prime"); + } + + public static void Task_1_8() + { + Console.WriteLine("Task 8 \nbet?"); + int inputNumber = Convert.ToInt16(inputBuffer()); + Random rnd = new Random(); + int cub = rnd.Next(1, 12); + int result; + if (cub <= 5) result = 0; + else if (cub == 12) result = inputNumber * 10; + else if (cub >= 6 && cub <= 8) result = inputNumber; + else result = inputNumber * 2; + Console.WriteLine(result); + } + + public static void Task_1_9() + { + Console.WriteLine("Task 9 \nsum?"); + int inputNumber = Convert.ToInt16(inputBuffer()); + Console.WriteLine("currency? whirte grn, euro or $"); + string curr = inputBuffer(); + if (curr == "grn") Console.WriteLine("{0} euros, {1} $s", inputNumber / 25, inputNumber / 30); + else if(curr=="euro") Console.WriteLine("{0} grns, {1} $s", inputNumber * 30, inputNumber *1.2 ); + else Console.WriteLine("{0} grns, {1} euros", inputNumber * 25, inputNumber / 1.2); + } + + public static void Task_1_10() + { + Console.WriteLine("input the number for table"); + int inputNumber = Convert.ToInt16(Console.ReadLine()); + for(int i = 1; i <= 20; i++) + { + Console.WriteLine("{0} * {1} = {2}", inputNumber, i, inputNumber * i); + } + } + public static void Task_1_11() + { + Console.WriteLine("input the numbere"); + string inputNumber = Console.ReadLine(); + Console.WriteLine(inputNumber.Length); + } + + public static void Task_1_12() + { + Random rnd = new Random(); + int secretNumber = rnd.Next(1, 146), customerChoice; + Console.WriteLine("try to guess the number between 1 to 146"); + do + { + Console.Write("variant ="); + customerChoice = Convert.ToInt16(inputBuffer()); + if (customerChoice == secretNumber) Console.WriteLine("YOU WON"); + else if (customerChoice > secretNumber) Console.WriteLine("less"); + else Console.WriteLine("more"); + } while (customerChoice != secretNumber); + } + public static void Task_1_13() + { + Console.WriteLine("input the number for table"); + int inputNumber = Convert.ToInt16(Console.ReadLine()); + for(int i=1; i*i + + + + Debug + AnyCPU + {520E81E7-A343-4CA3-A81E-1E215B8834A0} + Exe + Properties + Task_1 + Task-1 + v4.5.2 + 512 + 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