Dart darslari 1 Modul Beginner Dars. Kirish dars. Dartni o’rnatish



Yüklə 1,38 Mb.
səhifə6/9
tarix10.11.2022
ölçüsü1,38 Mb.
#119241
1   2   3   4   5   6   7   8   9
Dart

Objects

  1. Objects

  2. Cascader Operator

  3. Equality Type 1

  4. Equality Type 2

  5. Student List

  6. Student HashSet

Task 1
Quyidagicha Dog klass yarating va Dog klass orqali yaratilgan object larni tengligini “operator” orqali ta`minlang. Bu misolda object lar teng deyiladi qachonki ham kuchuklarning nomi va yoshi teng bo`lsa.
Dog dog1 = new Dog("tuffy", 5);
Dog dog2 = new Dog("tuffy", 5);

Task 2
1- masalani endi object tengligini tekshirishda foydalaniladigan “comparable” orqali hal qiling.

Task 3
Quyidagi 2 ta buyurtmalarni magazinda mavjud yoki mavjud emasligini aniqlaydigan klass va programma yozing.
List magazin = [
new Product("8271", "Monitor"),
new Product("8662", "iPad"),
new Product("0979", "Mac Book"),
new Product("1231", "iPod"),
new Product("8877", "iPhone")
];
Product product1 = Product("0979", "Mac Book Pro");
Product product2 = Product("8665", "iPad 12.9");


  1. Enumeration

    1. Enumeration

    2. Enum For 1

    3. Enum For 2

    4. Time Enum

    5. Error Class

Task 1
Quyidagicha Dog klass yarating va Dog klass orqali yaratilgan object larni tengligini “operator” orqali ta`minlang. Bu misolda object lar teng deyiladi qachonki ham kuchuklarning nomi va yoshi teng bo`lsa.
Dog dog1 = new Dog("tuffy", 5);
Dog dog2 = new Dog("tuffy", 5);

Task 2
Hafta kunlari uchun Enum yarating va undan foydalanib dayIsLike() degan metod yarating. Bu metod enum ning qiymatlariga qarab quyidagilardan birini chiqarsin.


Mondays are bad.
Fridays are better.
Weekends are best.
Midweek days are so-so

Task 3
Direction ni ko`rsatadigan enum yarating. (EAST, WEST, NORTH, SOUTH). Hamda getMyDirection method orqali quyidagi lardan birini chop qiladigan kod yozing.


In East Direction
In West Direction
In North Direction
In South Direction



  1. Yüklə 1,38 Mb.

    Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©muhaz.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin