theme changed

This commit is contained in:
nik
2025-09-30 08:21:09 +03:00
parent 4c261f7def
commit 8bd93df2ae
917 changed files with 15023 additions and 0 deletions

102
labs/lab9/MyClass/Book.cs Normal file
View File

@@ -0,0 +1,102 @@
using System;
class Book : Item
{
private String author;
private String title;
private String publisher;
private int pages;
private int year;
private static double price = 9;
private bool returnSrok = false;
static Book()
{
price = 10;
}
public Book()
{
}
public Book(String author, String title, String publisher, int pages, int year, long invNumber, bool taken) : base (invNumber, taken)
{
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 override void Show()
{
Console.WriteLine("\nКнига:\n Автор: {0}\n Название: {1}\n Год издания: {2}\n {3} стр.\n Стоимость аренды: {4}", author, title, year, pages, Book.price);
base.Show();
}
public double PriceBook(int s)
{
double cost = s * price;
return cost;
}
public override void Return()
{
taken = ReturnSrok;
}
public delegate void ProcessBookDelegate(Book book);
public void ProcessPaperbackBooks(ProcessBookDelegate processBook)
{
if (ReturnSrok)
processBook(this);
}
public static event ProcessBookDelegate RetSrok;
public bool ReturnSrok
{
get
{
return returnSrok;
}
set
{
returnSrok = value;
if (ReturnSrok == true)
RetSrok(this);
}
}
public override string ToString()
{
string str = this.title + ", " + this.author + " Инв. номер " + this.invNumber;
return str;
}
}

47
labs/lab9/MyClass/Item.cs Normal file
View File

@@ -0,0 +1,47 @@
using System;
abstract class Item
{
protected long invNumber;
protected bool taken;
public Item(long invNumber, bool taken)
{
this.invNumber = invNumber;
this.taken = taken;
}
public Item()
{
this.taken = true;
}
public bool IsAvailable()
{
return taken;
}
public long GetInvNumber()
{
return invNumber;
}
private void Take()
{
taken = false;
}
public void TakeItem()
{
if (this.IsAvailable())
this.Take();
}
abstract public void Return();
public virtual void Show()
{
Console.WriteLine("Состояние единицы хранения:\n Инвентарный номер: {0}\n Наличие: {1}", invNumber, taken);
}
}

View File

@@ -0,0 +1,33 @@
using System;
class Magazine : Item
{
private String volume;
private int number;
private String title;
private int year;
public Magazine(String volume, int number, String title, int year, long invNumber, bool taken) : base(invNumber, taken)
{
this.volume = volume;
this.number = number;
this.title = title;
this.year = year;
}
public Magazine()
{}
public override void Show()
{
Console.WriteLine("\nЖурнал:\n Том: {0}\n Номер: {1}\n Название: {2}\n Год выпуска: {3}", volume, number, title, year);
base.Show();
}
public override void Return()
{
taken = true;
}
}

View 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>

View File

@@ -0,0 +1,14 @@
using System;
class Operation
{
public static void PrintTitle(Book b)
{
b.Show();
}
public static void MetodObrabotchik(Book b)
{
Console.WriteLine("Книга {0} сдана в срок.", b.ToString());
}
}

View File

@@ -0,0 +1,73 @@
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());
*/
// Item item1 = new Item();
// item1.Show();
/*
Book b2 = new Book("Толстой Л. Н.", "Война и мир", "Наука и жизнь", 1234, 2013, 101, true);
b2.Show();
b2.TakeItem();
b2.Show();
Magazine mag1 = new Magazine("О природе", 5, "Земля и мы", 2014, 1235, true);
mag1.Show();
Console.WriteLine("\n Тестирование полиформизма");
Item it;
it = b2;
it.TakeItem();
it.Return();
it.Show();
it = mag1;
it.TakeItem();
it.Return();
it.Show();
*/
Book b4 = new Book("Толстой Л.Н.", "Анна Каренина", "Знание", 1204, 2014, 103, true);
Book b5 = new Book("Неш Т", "Программирование для профессионалов", "Вильямс", 1200, 2014, 108, true);
Book.RetSrok += new Book.ProcessBookDelegate(Operation.MetodObrabotchik);
b4.ReturnSrok = true;
b5.ReturnSrok = true;
Console.WriteLine("\nКниги возвращены в срок:");
b4.ProcessPaperbackBooks(Operation.PrintTitle);
b5.ProcessPaperbackBooks(Operation.PrintTitle);
}
}

View 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;
}
}

Binary file not shown.

View File

@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v9.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v9.0": {
"MyClass/1.0.0": {
"runtime": {
"MyClass.dll": {}
}
}
}
},
"libraries": {
"MyClass/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net9.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]

View 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("MyClass")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3d8c2bcfcb819e795b157f0ee3892cbbe80e98ce")]
[assembly: System.Reflection.AssemblyProductAttribute("MyClass")]
[assembly: System.Reflection.AssemblyTitleAttribute("MyClass")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -0,0 +1 @@
5f1e2d2b133ade4a16757283d3dfb38173bab760f9f2a01cde057378fdd200f8

View File

@@ -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 = MyClass
build_property.ProjectDir = /home/nik/oop/labs/lab9/MyClass/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 9.0
build_property.EnableCodeStyleSeverity =

View File

@@ -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;

View File

@@ -0,0 +1 @@
b6eeb5bdef6e2c02644aaa75969222ad56a8ae5fa848f2b9a0bf36c77dbdc1fd

View File

@@ -0,0 +1,28 @@
/home/nik/oop/labs/lab7/MyClass/bin/Debug/net9.0/MyClass
/home/nik/oop/labs/lab7/MyClass/bin/Debug/net9.0/MyClass.deps.json
/home/nik/oop/labs/lab7/MyClass/bin/Debug/net9.0/MyClass.runtimeconfig.json
/home/nik/oop/labs/lab7/MyClass/bin/Debug/net9.0/MyClass.dll
/home/nik/oop/labs/lab7/MyClass/bin/Debug/net9.0/MyClass.pdb
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/MyClass.GeneratedMSBuildEditorConfig.editorconfig
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/MyClass.AssemblyInfoInputs.cache
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/MyClass.AssemblyInfo.cs
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/MyClass.csproj.CoreCompileInputs.cache
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/MyClass.dll
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/refint/MyClass.dll
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/MyClass.pdb
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/MyClass.genruntimeconfig.cache
/home/nik/oop/labs/lab7/MyClass/obj/Debug/net9.0/ref/MyClass.dll
/home/nik/oop/labs/lab9/MyClass/bin/Debug/net9.0/MyClass
/home/nik/oop/labs/lab9/MyClass/bin/Debug/net9.0/MyClass.deps.json
/home/nik/oop/labs/lab9/MyClass/bin/Debug/net9.0/MyClass.runtimeconfig.json
/home/nik/oop/labs/lab9/MyClass/bin/Debug/net9.0/MyClass.dll
/home/nik/oop/labs/lab9/MyClass/bin/Debug/net9.0/MyClass.pdb
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/MyClass.GeneratedMSBuildEditorConfig.editorconfig
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/MyClass.AssemblyInfoInputs.cache
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/MyClass.AssemblyInfo.cs
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/MyClass.csproj.CoreCompileInputs.cache
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/MyClass.dll
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/refint/MyClass.dll
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/MyClass.pdb
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/MyClass.genruntimeconfig.cache
/home/nik/oop/labs/lab9/MyClass/obj/Debug/net9.0/ref/MyClass.dll

Binary file not shown.

View File

@@ -0,0 +1 @@
d590c4e74bd8755742999ea3cdcebb807222eb4693e8da32b2ee5d12d5003488

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,73 @@
{
"format": 1,
"restore": {
"/home/nik/oop/labs/lab9/MyClass/MyClass.csproj": {}
},
"projects": {
"/home/nik/oop/labs/lab9/MyClass/MyClass.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/nik/oop/labs/lab9/MyClass/MyClass.csproj",
"projectName": "MyClass",
"projectPath": "/home/nik/oop/labs/lab9/MyClass/MyClass.csproj",
"packagesPath": "/home/nik/.nuget/packages/",
"outputPath": "/home/nik/oop/labs/lab9/MyClass/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"
}
}
}
}
}

View 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>

View 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" />

View 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/lab9/MyClass/MyClass.csproj",
"projectName": "MyClass",
"projectPath": "/home/nik/oop/labs/lab9/MyClass/MyClass.csproj",
"packagesPath": "/home/nik/.nuget/packages/",
"outputPath": "/home/nik/oop/labs/lab9/MyClass/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"
}
}
}
}

View File

@@ -0,0 +1,10 @@
{
"version": 2,
"dgSpecHash": "foRFbJcq8dk=",
"success": true,
"projectFilePath": "/home/nik/oop/labs/lab9/MyClass/MyClass.csproj",
"expectedPackageFiles": [
"/home/nik/.nuget/packages/microsoft.aspnetcore.app.ref/9.0.9/microsoft.aspnetcore.app.ref.9.0.9.nupkg.sha512"
],
"logs": []
}