Skip to content

Commit

Permalink
16 homtask qilindi
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdurahmon0412 committed Aug 1, 2023
1 parent 1fc4a8a commit c37f69e
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 24 deletions.
24 changes: 23 additions & 1 deletion Homeworks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "N15", "N15", "{7001B7A0-52B
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "N15_HT1", "N15_HT1", "{14AF6728-E1B4-4BDC-834A-AE3F31A9AC18}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "N15_HT1", "N15_HT1\N15_HT1.csproj", "{FA506660-4B3D-43F1-A929-02FF76ECEDA8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "N15_HT1", "N15_HT1\N15_HT1.csproj", "{FA506660-4B3D-43F1-A929-02FF76ECEDA8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "N16", "N16", "{BBA0DBD8-DCE0-454B-A9ED-757F4ED6CF86}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "N16_HT1", "N16_HT1", "{F6504F23-BC5C-4B63-B6EA-CC1DBA6F69E4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "N16_HT1", "N16_HT1\N16_HT1.csproj", "{9B931C9D-B852-4F53-AC21-04E91C01D692}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "N16_HT2", "N16_HT2", "{08F4F27E-AC06-4149-BDF3-6E6469C72904}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "N16_HT2", "N16_HT2\N16_HT2.csproj", "{8213FB9A-5F09-4589-B8F9-58DCF6C7AEE5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -245,6 +255,14 @@ Global
{FA506660-4B3D-43F1-A929-02FF76ECEDA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA506660-4B3D-43F1-A929-02FF76ECEDA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA506660-4B3D-43F1-A929-02FF76ECEDA8}.Release|Any CPU.Build.0 = Release|Any CPU
{9B931C9D-B852-4F53-AC21-04E91C01D692}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B931C9D-B852-4F53-AC21-04E91C01D692}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B931C9D-B852-4F53-AC21-04E91C01D692}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B931C9D-B852-4F53-AC21-04E91C01D692}.Release|Any CPU.Build.0 = Release|Any CPU
{8213FB9A-5F09-4589-B8F9-58DCF6C7AEE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8213FB9A-5F09-4589-B8F9-58DCF6C7AEE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8213FB9A-5F09-4589-B8F9-58DCF6C7AEE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8213FB9A-5F09-4589-B8F9-58DCF6C7AEE5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -297,6 +315,10 @@ Global
{6835070D-5C81-447F-8E50-CD4EAE1E7633} = {D0D93D76-F4ED-4498-B467-7FC4CF037661}
{14AF6728-E1B4-4BDC-834A-AE3F31A9AC18} = {7001B7A0-52B9-41D7-BAC2-36D36E7EA689}
{FA506660-4B3D-43F1-A929-02FF76ECEDA8} = {14AF6728-E1B4-4BDC-834A-AE3F31A9AC18}
{F6504F23-BC5C-4B63-B6EA-CC1DBA6F69E4} = {BBA0DBD8-DCE0-454B-A9ED-757F4ED6CF86}
{9B931C9D-B852-4F53-AC21-04E91C01D692} = {F6504F23-BC5C-4B63-B6EA-CC1DBA6F69E4}
{08F4F27E-AC06-4149-BDF3-6E6469C72904} = {BBA0DBD8-DCE0-454B-A9ED-757F4ED6CF86}
{8213FB9A-5F09-4589-B8F9-58DCF6C7AEE5} = {08F4F27E-AC06-4149-BDF3-6E6469C72904}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8B77269B-B20D-4860-9637-2E2771096EE6}
Expand Down
47 changes: 24 additions & 23 deletions N15_HT1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,38 @@


//Birinchi shart
//var Day1 = new WeatherReport();
//Day1.AddWeatherInformation(new DateOnly(2023,07,29), "Bugun havo ancha issiq");
//Day1.AddWeatherInformation(new DateOnly(2023, 07, 30), "Ertaga havo harorati uzgarib turadi");
//Day1.AddWeatherInformation(new DateOnly(2023,07,31),"Abidgacha dimm bulatti Abittan kiyin jijja yomgir yogib rasa osh yikon havo buladi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 1),"Endi urtogla erta toza ochu havo buluriddi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 2), "Abidgacha nam havo buladi abiddan kiyin kam havo buladi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 3), "Efirda ohi bobo : Yengil shabada esodi");


var Day1 = new UltimateWeatherReport();
Day1.AddWeatherInformation(new DateOnly(2023, 08, 9), "Bugun havo ancha issiq");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 10), "Ertaga havo harorati uzgarib turadi");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 8), "Abidgacha dimm bulatti Abittan kiyin jijja yomgir yogib rasa osh yikon havo buladi");
var Day1 = new WeatherReport();
Day1.AddWeatherInformation(new DateOnly(2023, 08, 29), "Bugun havo ancha issiq");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 29), "Ertaga havo harorati uzgarib turadi");
Day1.AddWeatherInformation(new DateOnly(2023, 07, 31), "Abidgacha dimm bulatti Abittan kiyin jijja yomgir yogib rasa osh yikon havo buladi");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 1), "Endi urtogla erta toza ochu havo buluriddi");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 2), "Abidgacha nam havo buladi abiddan kiyin kam havo buladi");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 3), "garbdan shamol yomon esadi oma likin");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 4), "Tufon bumaydi ");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 5), "Buron bumaydi unaqa ob havoni bizani yuragimiz kutarmaydi");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 6), "Jala quyadi ");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 7), "Qor yogsa kerak");
Day1.AddWeatherInformation(new DateOnly(2023, 08, 3), "Efirda ohi bobo : Yengil shabada esodi");


//var Day1 = new UltimateWeatherReport();
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 9), "Bugun havo ancha issiq");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 10), "Ertaga havo harorati uzgarib turadi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 8), "Abidgacha dimm bulatti Abittan kiyin jijja yomgir yogib rasa osh yikon havo buladi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 1), "Endi urtogla erta toza ochu havo buluriddi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 2), "Abidgacha nam havo buladi abiddan kiyin kam havo buladi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 3), "garbdan shamol yomon esadi oma likin");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 4), "Tufon bumaydi ");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 5), "Buron bumaydi unaqa ob havoni bizani yuragimiz kutarmaydi");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 6), "Jala quyadi ");
//Day1.AddWeatherInformation(new DateOnly(2023, 08, 7), "Qor yogsa kerak");

Console.WriteLine( Day1.GetWeather(new DateOnly(2023,08,29)));

var GetWet1 = Day1.GetWeather(new DateOnly(2023, 08, 1), 5);
foreach (var b in GetWet1)
{
Console.WriteLine(b);
}
//var GetWet1 = Day1.GetWeather(new DateOnly(2023, 08, 1), 5);
//foreach (var b in GetWet1)
//{
// Console.WriteLine(b);
//}

//Console.WriteLine();
//var Getwether2 = Day1.GetWeather(9);
//var Getwether2 = Day1.GetWeather(9);
//foreach (var b in Getwether2)
//{
// Console.WriteLine(b);
Expand Down
10 changes: 10 additions & 0 deletions N16_HT1/N16_HT1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
17 changes: 17 additions & 0 deletions N16_HT1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using N16_HT1;
using System.ComponentModel;
using System.Reflection.Metadata;
using System.Xml.Linq;

//- bitta object yarating, speed va trajectory ni har xil qiymatlarga o'zgartirib ekranga chiqaring

var AirPlane = new Spaceship("Boing97",1000);
AirPlane.Speed = 1000;
AirPlane.Trajectory = 250000;
Console.WriteLine(AirPlane);
AirPlane.Speed = 2000;
AirPlane.Trajectory = 241100;
Console.WriteLine(AirPlane);



52 changes: 52 additions & 0 deletions N16_HT1/Spaceship.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//unda quyidagi propertylar bo'lsin
//- Name - nomi ( init-only )
//-Fuel - yoqilg'i miqdori ( read-only )
//- Speed - tezligi(read - write)
//- Trajectory - trayektoriyasi(write - only)

//- bitta object yarating, speed va trajectory ni har xil qiymatlarga o'zgartirib ekranga chiqaring
namespace N16_HT1
{
public class Spaceship
{
public Spaceship(string name,double fuel)
{
Name = name;
_fuel = fuel;

}
public string Name { get; init; }

private double _trajectory;
public double Trajectory
{
set { _trajectory = value; }
}

private readonly double _fuel;
public double Fuel => _fuel;

private double _speed;
public double Speed
{
get
{
return _speed;
}
set
{
_speed = value;
}
}

public override string ToString()
{
return $"{Name} - {Fuel} - {Speed}";
}
}
}
10 changes: 10 additions & 0 deletions N16_HT2/N16_HT2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
56 changes: 56 additions & 0 deletions N16_HT2/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//unda quyidagi methodlar bo'lsin
//- Activate methodi yordamida ishga tushiriladigan ( activate ) qilinadigan bo'lsin
//- DisplayHomeTemperature - bunda vaqt davomida foydalanuvchi xohlagan va SmartHome ta'minlay olgan temperatura chiqsin

//- temperaturani expected va current qiymatlarini saqlash uchun Temperature modelidan foydalanish mumkin

//Exmaple

//foydaluvchi xohlagan va SmartHome ta'minlay olgan temperaturani quyidagicha dastur o'zida kiritsangiz bo'ladi

//ExpectedTemperature = 20
//CurrentTemperature = 22
//CurrentTemperature = 23
//CurrentTemperature = 21
//CurrentTemperature = 20
//ExpectedTemperature = 25
//CurrentTemperature = 21
//CurrentTemperature = 22
//CurrentTemperature = 23

//DisplayHomeTemperature natijasi

//Expected - 20, Current - 22
//Expected - 20, Current - 23
//Expected - 20, Current - 21
//Expected - 20, Current - 20
//Expected - 25, Current - 21
//Expected - 25, Current - 22
//Expected - 25, Current - 23

namespace N16_HT2
{
class Program
{
static void Main(string[] args)
{
var Tempratures = new List<Temprature>();
Tempratures.Add(new Temprature(20, 22));
Tempratures.Add(new Temprature(20, 23));
Tempratures.Add(new Temprature(20, 21));
Tempratures.Add(new Temprature(20, 20));
Tempratures.Add(new Temprature(25, 21));
Tempratures.Add(new Temprature(25, 22));
Tempratures.Add(new Temprature(25, 23));


var SmartHouse = new SmartHomeService("Deviser", Tempratures);
SmartHouse.Activated();
SmartHouse.DisplayHomeTemperature();
}
}
}




53 changes: 53 additions & 0 deletions N16_HT2/SmartHomeService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace N16_HT2
{
public class SmartHomeService
{
public bool _isActivated { get; private set; }
public bool IsActivated => _isActivated;
private string _deviceName;

public string DeviceName
{
get => _deviceName;

init => _deviceName = value;
}
private List<Temprature> ListTemperature = new List<Temprature>();



public SmartHomeService(string device,List<Temprature> listTemprature)
{
DeviceName = device;
ListTemperature = listTemprature;
}

public bool Activated()
{
_isActivated = true;
return _isActivated;
}

public void DisplayHomeTemperature()
{
if(IsActivated== false)
{
throw new ArgumentNullException("Temperaturea umuman mavjud emas");
}
else
{
foreach(var temp in ListTemperature)
{
Console.WriteLine(temp);
}
}

}
}
}
26 changes: 26 additions & 0 deletions N16_HT2/Temprature.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace N16_HT2
{
public class Temprature
{

public Temprature(int extected, int currented)
{
CurrentTemperature = currented;
ExtectedTemperature = extected;
}
public int CurrentTemperature { get; private set; }
public int ExtectedTemperature { get; set; }


public override string ToString()
{
return $"Expected - {ExtectedTemperature}, Current - {CurrentTemperature} ";
}
}
}

0 comments on commit c37f69e

Please sign in to comment.