-
Notifications
You must be signed in to change notification settings - Fork 23
Anastasija zajtseva #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Anastasija_Zajtseva
Are you sure you want to change the base?
Changes from 5 commits
2a2c270
5e51ad0
57c8d90
04a2809
ee71a4c
9969670
c4a7f5d
fab3925
35c11ae
bc60700
292a21d
31b0eab
a06bf51
d794ab5
7ac8860
9974217
cd1209f
bb0b2a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| using System; | ||
|
|
||
| namespace CourseApp | ||
| { | ||
| public class City | ||
| { | ||
| public string Country { get; set; } | ||
| private int population; | ||
| public string Name { get; set; } | ||
|
|
||
| public int Population | ||
| { | ||
| get | ||
| { | ||
| return population; | ||
| } | ||
| set | ||
| { | ||
| if (value > 0) | ||
| { | ||
| this.population = value; | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| public City() { Name = "Иваново"; Country = "Россия"; population = 316; } // 1 конструктор | ||
|
|
||
| public City(string n, string m) { Name = n; Country = m; population = 11000; } // 2 конструктор | ||
|
|
||
| public City(string n, string m, int a) { Name = n; Country = m; population = a; } // 3 конструктор | ||
| public void GetInfo() | ||
| { | ||
| Console.WriteLine($"Название: {Name} Страна: {Country} Популяция: {population}"); | ||
| } | ||
| public void s(int pop) | ||
| { | ||
| population += pop; | ||
| } | ||
| public void Ueh() | ||
|
||
| { | ||
| Console.WriteLine($"Из-за ужасной ядерной катастрофы всё население Иванова вымерло"); | ||
| } | ||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio 15 | ||
| VisualStudioVersion = 15.0.27428.2037 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CourseApp", "CourseApp.csproj", "{3F1471F2-2FB2-4B42-BC14-ECEA29012CB4}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test", "..\test\test.csproj", "{F41FC357-FFB9-4654-9C10-87F548367AD4}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {3F1471F2-2FB2-4B42-BC14-ECEA29012CB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {3F1471F2-2FB2-4B42-BC14-ECEA29012CB4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {3F1471F2-2FB2-4B42-BC14-ECEA29012CB4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {3F1471F2-2FB2-4B42-BC14-ECEA29012CB4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {F41FC357-FFB9-4654-9C10-87F548367AD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {F41FC357-FFB9-4654-9C10-87F548367AD4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {F41FC357-FFB9-4654-9C10-87F548367AD4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {F41FC357-FFB9-4654-9C10-87F548367AD4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {0AB63177-0A3F-4523-9C64-57B9FF0F9AE0} | ||
| EndGlobalSection | ||
| EndGlobal |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| # Course of c# | ||
|
|
||
| Please write your name and surname here | ||
| ��������� ������� | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Можо каким-то другим редактором поддреживающим кодировку? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| using System; | ||
|
|
||
| namespace CourseApp3 | ||
| { | ||
| class Program4 | ||
| { | ||
|
|
||
| static void Main(string[] args) | ||
| { | ||
| double xn = 0.15; | ||
| double xk = 1.37; | ||
| double dx = 0.25; | ||
| double[] xx = { 0.2, 0.3, 0.44, 0.6, 0.56 }; | ||
|
|
||
| Console.WriteLine("под А"); | ||
|
|
||
| for (double x = xn; x < xk; x += dx) | ||
| { | ||
| Console.WriteLine(Fan(x)); | ||
|
|
||
| } | ||
| Console.WriteLine("под B"); | ||
| foreach (double x in xx) | ||
| { | ||
| Console.WriteLine(Fan(x)); | ||
| } | ||
| } | ||
| static double Fan(double x) | ||
| { | ||
| double a = 0.1; | ||
|
||
| double b = 0.5; | ||
| double y; | ||
| y = ((a + (Math.Tan(b * x)) * (Math.Tan(b * x))) / (b + (1 / (Math.Tan(a * x))) * (1 / (Math.Tan(a * x))))); | ||
|
||
| return y; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| using System; | ||
| using Xunit; | ||
| using CourseApp; | ||
|
|
||
| namespace test | ||
| { | ||
| public class UnitTest1 | ||
| { | ||
| [Fact] | ||
| public void Test1() | ||
| { | ||
| City ivanovo = new City(); | ||
| var res_country = ivanovo.Country; | ||
|
||
| var res_population = ivanovo.Population ; | ||
| var res_name = ivanovo.Name; | ||
| Assert.Equal("������", res_country); | ||
| Assert.Equal(316, res_population); | ||
| Assert.Equal("�������", res_name); | ||
| } | ||
| [Fact] | ||
| public void Test2() | ||
| { | ||
| City moscow = new City("������","������"); | ||
| var res_country = moscow.Country; | ||
| var res_population = moscow.Population; | ||
| var res_name = moscow.Name; | ||
| Assert.Equal("������", res_country); | ||
| Assert.Equal(11000, res_population); | ||
| Assert.Equal("������", res_name); | ||
| } | ||
| [Fact] | ||
| public void Test3() | ||
| { | ||
| City spb = new City("�����", "������", 9000); | ||
| var res_country = spb.Country; | ||
| var res_population = spb.Population; | ||
| var res_name = spb.Name; | ||
| Assert.Equal("������", res_country); | ||
| Assert.Equal(9000, res_population); | ||
| Assert.Equal("�����", res_name); | ||
| } | ||
| [Fact] | ||
|
||
| public void Test4() | ||
| { | ||
| var res = Program.formula(0.1, 0.5, 0.15); | ||
| Assert.Equal(0.001, res, 3); | ||
| } | ||
| [Fact] | ||
| public void Test5() | ||
| { | ||
| var res = Program.formula(0.0, 0.0, 0.1); | ||
| Assert.Equal(0.0, res, 3); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>netcoreapp2.0</TargetFramework> | ||
|
|
||
| <IsPackable>false</IsPackable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" /> | ||
| <PackageReference Include="xunit" Version="2.3.1" /> | ||
| <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" /> | ||
| <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\CourseApp\CourseApp.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio 15 | ||
| VisualStudioVersion = 15.0.27428.2037 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test", "test.csproj", "{54005DE3-DDA5-4054-B1E5-C615C6978944}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {54005DE3-DDA5-4054-B1E5-C615C6978944}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {54005DE3-DDA5-4054-B1E5-C615C6978944}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {54005DE3-DDA5-4054-B1E5-C615C6978944}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {54005DE3-DDA5-4054-B1E5-C615C6978944}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {4F11FC6D-B967-4BB4-B687-47D6434B6F5D} | ||
| EndGlobalSection | ||
| EndGlobal |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio 15 | ||
| VisualStudioVersion = 15.0.27428.2037 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp6", "ConsoleApp6\ConsoleApp6.csproj", "{8DB91C96-3426-4D10-8352-4A179858C483}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {8DB91C96-3426-4D10-8352-4A179858C483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {8DB91C96-3426-4D10-8352-4A179858C483}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {8DB91C96-3426-4D10-8352-4A179858C483}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {8DB91C96-3426-4D10-8352-4A179858C483}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {CA85E5A4-6EF8-429A-9DCE-3C7AD673C43E} | ||
| EndGlobalSection | ||
| EndGlobal |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>netcoreapp2.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| using System; | ||
|
|
||
| namespace CourseApp | ||
| { | ||
| class City | ||
| { | ||
| public string country; | ||
| public int population; | ||
| public string name; | ||
|
|
||
| public City() { name = "Иваново"; country = "Россия"; population = 316 ; } // 1 конструктор | ||
|
||
|
|
||
| public City(string n, string m) { name = n; country = m; population = 11000; } // 2 конструктор | ||
|
|
||
| public City(string n, string m, int a) { name = n; country = m; population = a; } | ||
| public void GetInfo() | ||
| { | ||
| Console.WriteLine($"Название: {name} Страна: {country} Популяция: {population}"); | ||
| } | ||
| public void s(int pop) | ||
| { | ||
| population += pop; | ||
| } | ||
| public void Ueh() | ||
| { | ||
| Console.WriteLine($"Из-за ужасной ядерной катастрофы всё население Иванова вымерло"); | ||
| } | ||
|
|
||
| } | ||
| class Program | ||
| { | ||
| static void Main(string[] args) | ||
| { | ||
| City ivanovo = new City(); // вызов 1-ого конструктора без параметров | ||
| City moscow = new City("Москва", "Россия"); //вызов 2-ого конструктора с одним параметром | ||
| City peter = new City("Питер", "Россия", 9000); | ||
|
|
||
|
|
||
| ivanovo.GetInfo(); | ||
| moscow.GetInfo(); | ||
| peter.GetInfo(); | ||
|
|
||
|
|
||
| ivanovo.s(100); | ||
| ivanovo.GetInfo(); | ||
|
|
||
| ivanovo.Ueh(); | ||
|
|
||
| Console.Read(); | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переиспользуйте конструктор - данный донструктор без параметров должен вызвать основной констурктор, передав ему все параметры