-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fc4a8a
commit c37f69e
Showing
9 changed files
with
271 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} "; | ||
} | ||
} | ||
} |