two left
This commit is contained in:
64
labs/lab6_done/Book/Book.cs
Normal file
64
labs/lab6_done/Book/Book.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
class Book
|
||||
{
|
||||
private String author;
|
||||
private String title;
|
||||
private String publisher;
|
||||
private int pages;
|
||||
private int year;
|
||||
|
||||
private static double price = 9;
|
||||
|
||||
static Book()
|
||||
{
|
||||
price = 10;
|
||||
}
|
||||
|
||||
public Book()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Book(String author, String title, String publisher, int pages, int year)
|
||||
{
|
||||
this.author = author;
|
||||
this.title = title;
|
||||
this.publisher = publisher;
|
||||
this.pages = pages;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public Book(String author, String title)
|
||||
{
|
||||
this.author = author;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void SetBook(String author, String title, String publisher, int pages, int year)
|
||||
{
|
||||
this.author = author;
|
||||
this.title = title;
|
||||
this.publisher = publisher;
|
||||
this.pages = pages;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public static void SetPrice(double price)
|
||||
{
|
||||
Book.price = price;
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
Console.WriteLine("\nКнига:\n Автор: {0}\n Название: {1}\n Год издания: {2}\n {3} стр.\n Стоимость аренды: {4}", author, title, year, pages, Book.price);
|
||||
}
|
||||
|
||||
public double PriceBook(int s)
|
||||
{
|
||||
double cost = s * price;
|
||||
return cost;
|
||||
}
|
||||
|
||||
}
|
||||
10
labs/lab6_done/Book/Book.csproj
Normal file
10
labs/lab6_done/Book/Book.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
31
labs/lab6_done/Book/Program.cs
Normal file
31
labs/lab6_done/Book/Program.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Book b1 = new Book();
|
||||
b1.SetBook("Пушкин А.С.", "Капитанская дочка", "Вильямс", 123, 2012);
|
||||
Book.SetPrice(12);
|
||||
b1.Show();
|
||||
Console.WriteLine("\n Итоговая стоимость аренды: {0} р.", b1.PriceBook(3));
|
||||
|
||||
Book b2 = new Book("Толстой Л.Н.", "Война и мир", "Наука и жизнь", 1234, 2013);
|
||||
b2.Show();
|
||||
|
||||
Book b3 = new Book("Лермонтов М.Ю.", "Мцыри");
|
||||
b3.Show();
|
||||
|
||||
|
||||
Triangle t1 = new Triangle(3, 4, 5);
|
||||
t1.Show();
|
||||
Console.WriteLine("perimeter = {0}", t1.Perimeter());
|
||||
Console.WriteLine("area = {0}", t1.Area());
|
||||
Console.WriteLine("does this triangle exist? {0}", t1.Exists());
|
||||
|
||||
Triangle t2 = new Triangle(3, 4, 7);
|
||||
t2.Show();
|
||||
Console.WriteLine("does this triangle exist? {0}", t2.Exists());
|
||||
|
||||
}
|
||||
}
|
||||
42
labs/lab6_done/Book/Triangle.cs
Normal file
42
labs/lab6_done/Book/Triangle.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
|
||||
class Triangle
|
||||
{
|
||||
private int a;
|
||||
private int b;
|
||||
private int c;
|
||||
|
||||
public Triangle(int a, int b, int c)
|
||||
{
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
Console.WriteLine("a: {0}\nb: {1}\nc: {2}", a, b, c);
|
||||
}
|
||||
|
||||
public int Perimeter()
|
||||
{
|
||||
return a + b + c;
|
||||
}
|
||||
|
||||
public double Area()
|
||||
{
|
||||
double p = Perimeter() / 2;
|
||||
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
|
||||
}
|
||||
|
||||
public bool Exists()
|
||||
{
|
||||
if (a <= 0 || b <= 0 || c <= 0) return false;
|
||||
|
||||
double maxSide = Math.Max(Math.Max(a, b), Math.Max(b, c));
|
||||
|
||||
if (maxSide >= a + b + c - maxSide) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
BIN
labs/lab6_done/Book/bin/Debug/net9.0/Book
Executable file
BIN
labs/lab6_done/Book/bin/Debug/net9.0/Book
Executable file
Binary file not shown.
23
labs/lab6_done/Book/bin/Debug/net9.0/Book.deps.json
Normal file
23
labs/lab6_done/Book/bin/Debug/net9.0/Book.deps.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v9.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v9.0": {
|
||||
"Book/1.0.0": {
|
||||
"runtime": {
|
||||
"Book.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"Book/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
labs/lab6_done/Book/bin/Debug/net9.0/Book.dll
Normal file
BIN
labs/lab6_done/Book/bin/Debug/net9.0/Book.dll
Normal file
Binary file not shown.
BIN
labs/lab6_done/Book/bin/Debug/net9.0/Book.pdb
Normal file
BIN
labs/lab6_done/Book/bin/Debug/net9.0/Book.pdb
Normal file
Binary file not shown.
12
labs/lab6_done/Book/bin/Debug/net9.0/Book.runtimeconfig.json
Normal file
12
labs/lab6_done/Book/bin/Debug/net9.0/Book.runtimeconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net9.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "9.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
73
labs/lab6_done/Book/obj/Book.csproj.nuget.dgspec.json
Normal file
73
labs/lab6_done/Book/obj/Book.csproj.nuget.dgspec.json
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"/home/nik/oop/labs/lab6/Book/Book.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"/home/nik/oop/labs/lab6/Book/Book.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "/home/nik/oop/labs/lab6/Book/Book.csproj",
|
||||
"projectName": "Book",
|
||||
"projectPath": "/home/nik/oop/labs/lab6/Book/Book.csproj",
|
||||
"packagesPath": "/home/nik/.nuget/packages/",
|
||||
"outputPath": "/home/nik/oop/labs/lab6/Book/obj/",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"/home/nik/.nuget/NuGet/NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.100"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[9.0.9, 9.0.9]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/9.0.110/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
labs/lab6_done/Book/obj/Book.csproj.nuget.g.props
Normal file
15
labs/lab6_done/Book/obj/Book.csproj.nuget.g.props
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/nik/.nuget/packages/</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/nik/.nuget/packages/</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.4</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="/home/nik/.nuget/packages/" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
2
labs/lab6_done/Book/obj/Book.csproj.nuget.g.targets
Normal file
2
labs/lab6_done/Book/obj/Book.csproj.nuget.g.targets
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
||||
22
labs/lab6_done/Book/obj/Debug/net9.0/Book.AssemblyInfo.cs
Normal file
22
labs/lab6_done/Book/obj/Debug/net9.0/Book.AssemblyInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Book")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+83c6a0637a0884d0045ccdda53c229410f964e7d")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Book")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Book")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
48015d2ed9b8286cbddc35f9427e7fe648ed493a5704c3bab7b74917d37f4169
|
||||
@@ -0,0 +1,15 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net9.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = Book
|
||||
build_property.ProjectDir = /home/nik/oop/labs/lab6/Book/
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
@@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
||||
BIN
labs/lab6_done/Book/obj/Debug/net9.0/Book.assets.cache
Normal file
BIN
labs/lab6_done/Book/obj/Debug/net9.0/Book.assets.cache
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
2faabec596fcdbf5e724bf08006addca0113d5bf7018a6edb9fe97fd3d2f1d25
|
||||
@@ -0,0 +1,14 @@
|
||||
/home/nik/oop/labs/lab6/Book/bin/Debug/net9.0/Book
|
||||
/home/nik/oop/labs/lab6/Book/bin/Debug/net9.0/Book.deps.json
|
||||
/home/nik/oop/labs/lab6/Book/bin/Debug/net9.0/Book.runtimeconfig.json
|
||||
/home/nik/oop/labs/lab6/Book/bin/Debug/net9.0/Book.dll
|
||||
/home/nik/oop/labs/lab6/Book/bin/Debug/net9.0/Book.pdb
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/Book.GeneratedMSBuildEditorConfig.editorconfig
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/Book.AssemblyInfoInputs.cache
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/Book.AssemblyInfo.cs
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/Book.csproj.CoreCompileInputs.cache
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/Book.dll
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/refint/Book.dll
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/Book.pdb
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/Book.genruntimeconfig.cache
|
||||
/home/nik/oop/labs/lab6/Book/obj/Debug/net9.0/ref/Book.dll
|
||||
BIN
labs/lab6_done/Book/obj/Debug/net9.0/Book.dll
Normal file
BIN
labs/lab6_done/Book/obj/Debug/net9.0/Book.dll
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
2452364a71f303ed10f59034cc77792f2db009c3bf86117b7c2ecac4195e9088
|
||||
BIN
labs/lab6_done/Book/obj/Debug/net9.0/Book.pdb
Normal file
BIN
labs/lab6_done/Book/obj/Debug/net9.0/Book.pdb
Normal file
Binary file not shown.
BIN
labs/lab6_done/Book/obj/Debug/net9.0/apphost
Executable file
BIN
labs/lab6_done/Book/obj/Debug/net9.0/apphost
Executable file
Binary file not shown.
BIN
labs/lab6_done/Book/obj/Debug/net9.0/ref/Book.dll
Normal file
BIN
labs/lab6_done/Book/obj/Debug/net9.0/ref/Book.dll
Normal file
Binary file not shown.
BIN
labs/lab6_done/Book/obj/Debug/net9.0/refint/Book.dll
Normal file
BIN
labs/lab6_done/Book/obj/Debug/net9.0/refint/Book.dll
Normal file
Binary file not shown.
78
labs/lab6_done/Book/obj/project.assets.json
Normal file
78
labs/lab6_done/Book/obj/project.assets.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net9.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net9.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"/home/nik/.nuget/packages/": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "/home/nik/oop/labs/lab6/Book/Book.csproj",
|
||||
"projectName": "Book",
|
||||
"projectPath": "/home/nik/oop/labs/lab6/Book/Book.csproj",
|
||||
"packagesPath": "/home/nik/.nuget/packages/",
|
||||
"outputPath": "/home/nik/oop/labs/lab6/Book/obj/",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"/home/nik/.nuget/NuGet/NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.100"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[9.0.9, 9.0.9]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/9.0.110/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
labs/lab6_done/Book/obj/project.nuget.cache
Normal file
10
labs/lab6_done/Book/obj/project.nuget.cache
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "ny3c6FZ8xC0=",
|
||||
"success": true,
|
||||
"projectFilePath": "/home/nik/oop/labs/lab6/Book/Book.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"/home/nik/.nuget/packages/microsoft.aspnetcore.app.ref/9.0.9/microsoft.aspnetcore.app.ref.9.0.9.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
Reference in New Issue
Block a user