Topshiriqlar Biror nomlar fazosi hosil qiling


Download 38.5 Kb.
bet4/4
Sana17.06.2023
Hajmi38.5 Kb.
#1545988
1   2   3   4
Bog'liq
komili 2

protected int Yoshi,Soni,Yashash_davri;
}
public partial class Yovvoyi_hayvonlar:Hayvonlar
{
public int yoshi{set;get;}
public int soni{set;get;}
public int yashash_davri{set;get;}
string a1,b1,c1; int a2,b2,c2;
public void kirit(int a,int b,int c)
{
yoshi=a;
soni=b;
yashash_davri=c;
}
public Yovvoyi_hayvonlar(string a, string b, string c)
{
a1=a;b1=b;c1=c;
kirit(a1,b1,c1);
}
public Yovvoyi_hayvonlar(int a,int b, int c)
{
a2=a;b2=b;c2=c;
kirit(a2,b2,c2);
}
public void kirit(string a,string b,string c)
{
Tur=a; Hayotiy_shakli=b; Ozuqasi=c;
}
public void Chiqar() 
{
Console.Clear();
Console.WriteLine("Hayvon turi:\t{0}\nHayotiy shakli:\t{1}\nOziqlanishi:\t{2}",Turi,Hayotiy_shakli,Oziqlanishi);
Console.WriteLine("Yoshi:\t\t{0}\nsoni:\t\t{1}\nyashash davri:\t\t{2}",Yoshi,Vazni,Uzunligi);
}
}

}
namespace komili


{
class Program
{
public static void Main(string[] args)
{
Jonzotlar.Talaba talaba=new Jonzotlar.Talaba();
talaba.Kirit1();talaba.Chiqar();talaba.Chiqar1();
Console.ReadKey(true);
string a1,b1,c1; int a2,b2,c2;
Console.Clear();
Console.Write("Hayvon turini kiriting:");
a1=Console.ReadLine();
Console.Write("Hayotiy shaklini kiriting:");
b1=Console.ReadLine();
Console.Write("Ozuqasini kiriting:");
c1=Console.ReadLine();
Console.Write("Yoshini kiriting:");
a2=int.Parse(Console.ReadLine());
Console.Write("Sonini kiriting:");
b2=int.Parse(Console.ReadLine());
Console.Write("Yashash davrini kiriting:");
c2=int.Parse(Console.ReadLine());
Jonzotlar.Yovvoyi_hayvonlar a=new Jonzotlar.Yovvoyi_hayvonlar(a1,b1,c1);
Jonzotlar.Yovvoyi_hayvonlar b=new Jonzotlar.Yovvoyi_hayvonlar(a2,b2,c2);
a.Chiqar(); b.Chiqar();
Console.ReadKey(true);
}
}
}
10. Operatorlarni qayta yuklashni amalga oshiring
using System;
namespace Jonzotlar
{
class Odam
{
public string FIO,Manzil;
public int Yosh,Vazn,Boy,Telefoni;

}
public partial class Talaba


{
public string FIO,Manzil;
public int Yosh,Vazn,Boy,Telefoni;
public Talaba()
{
Kirit();
}
public void Kirit()
{
Console.Write("Ismingizni kiriting: ");
FIO=Console.ReadLine();
Console.Write("Manzilingizni kiriting: ");
Manzil=Console.ReadLine();
Console.Write("Yoshingizni kiring: ");
Yosh=Convert.ToInt32(Console.ReadLine());
Console.Write("Vazningizni kiriting (kg): ");
Vazn=Convert.ToInt32(Console.ReadLine());
Console.Write("Bo'yingizni kiriting (sm): ");
Boy=Convert.ToInt32(Console.ReadLine());
Console.Write("Telefoningizni kiring: ");
Telefoni=Convert.ToInt32(Console.ReadLine());
}
public void Chiqar()
{
Console.Clear();
Console.WriteLine("FIO:\t\t{0}\nManzil:\t\t{1}\nYoshingiz:\t\t{2}\nVazningiz:\t\t{3}kg\nBo'yingiz:\t\t{4}sm\nTelefoni:\t\t{5}\n",FIO,Manzil,Yosh,Vazn,Boy,Telefoni);
}
}
public partial class Talaba
{
public string OTM{set;get;}
int kurs,talabalik_yili;
public int Kurs
{
set
{
if(0<value && value<4)
kurs=value;
else Console.WriteLine("Xato kiritdingiz!!!");
}
get{return kurs;}
}
public int Talabalik_yili
{
set 
{
if(0<value && value<4)
{talabalik_yili=value;}
else Console.WriteLine("Xato kiritdingiz!!!");
}
get{return talabalik_yili;}
}
public void Kirit1()
{
Console.Write("O'qish joyini kiriting:");
OTM=Console.ReadLine();
Console.Write("Kursingizni kiriting:");
Kurs=int.Parse(Console.ReadLine());
}
public void Chiqar1()
{
Console.WriteLine("O'qish joyi:\t{0}\nO'qish yili:{1}yil\nHozirda:\t{2} kurs",OTM,talabalik_yili,Kurs);
}

}


public class Hayvonlar
{
public string Nomi,Turi,Oziqlanishi;
public int Yoshi,Vazni,Uzunligi;
}
public partial class Yovvoyi_hayvonlar
{
public string Tur,Hayotiy_shakli,Ozuqasi;
protected int Yoshi,Soni,Yashash_davri;
}
public partial class Yovvoyi_hayvonlar:Hayvonlar
{
public int yoshi{set;get;}
public int soni{set;get;}
public int yashash_davri{set;get;}
string a1,b1,c1; int a2,b2,c2;
public void kirit(int a,int b,int c)
{
yoshi=a;
soni=b;
yashash_davri=c;
}
public Yovvoyi_hayvonlar(string a, string b, string c)
{
a1=a;b1=b;c1=c;
kirit(a1,b1,c1);
}
public Yovvoyi_hayvonlar(int a,int b, int c)
{
a2=a;b2=b;c2=c;
kirit(a2,b2,c2);
}
public void kirit(string a,string b,string c)
{
Tur=a; Hayotiy_shakli=b; Ozuqasi=c;
}
public void Chiqar() 
{
Console.Clear();
Console.WriteLine("Hayvon turi:\t{0}\nHayotiy shakli:\t{1}\nOziqlanishi:\t{2}",Turi,Hayotiy_shakli,Oziqlanishi);
Console.WriteLine("Yoshi:\t\t{0}\nsoni:\t\t{1}\nyashash davri:\t\t{2}",Yoshi,Vazni,Uzunligi);
}
}

}
namespace komili


{
class Program
{
public static void Main(string[] args)
{
Jonzotlar.Talaba talaba=new Jonzotlar.Talaba();
talaba.Kirit1();talaba.Chiqar();talaba.Chiqar1();
Console.ReadKey(true);
string a1,b1,c1; int a2,b2,c2;
Console.Clear();
Console.Write("Hayvon turini kiriting:");
a1=Console.ReadLine();
Console.Write("Hayotiy shaklini kiriting:");
b1=Console.ReadLine();
Console.Write("Ozuqasini kiriting:");
c1=Console.ReadLine();
Console.Write("Yoshini kiriting:");
a2=int.Parse(Console.ReadLine());
Console.Write("Sonini kiriting:");
b2=int.Parse(Console.ReadLine());
Console.Write("Yashash davrini kiriting:");
c2=int.Parse(Console.ReadLine());
Jonzotlar.Yovvoyi_hayvonlar a=new Jonzotlar.Yovvoyi_hayvonlar(a1,b1,c1);
Jonzotlar.Yovvoyi_hayvonlar b=new Jonzotlar.Yovvoyi_hayvonlar(a2,b2,c2);
a.Chiqar(); b.Chiqar();
Console.ReadKey(true);
}
}
}

Bajardi:Shovkatjonov Komiljon Qabul qildi:E.Islomov

Download 38.5 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling