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



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

Dars. Classes

  1. Class

  2. Class Student

  3. Class User

  4. Constructor

  5. Getter, Setter

  6. Static

  7. Tasks

1-topshiriq Dog Info
Quyidagicha malumotlarni chop qiladigan funksiyali Dog klass yarating.
Dog dog = new Dog("tuffy", 5, "white");
dog.infos();
Hi my name is tuffy.
My age is 5 and my color is white.

2-topshiriq Strong Number


Berilgan raqam “Strong Number” ekanligini yoki emasligini chop qiladigan funksiyali Class yarating.
Raqam strong deyiladi agar quyidagi shartni bajarsa: ABC = A! + B! + C!
Masalan:
145 bu strong number chunki: 145 = 1! + 4! + 5!
12 bu strong number emas chunki: 12 != 1! + 2!
StrongNum num = new StrongNum(145);
num.isStrong();// true, false

3-topshiriq Unique Numbers


Berilgan oraliqda mavjud bo`lgan “unique” raqamlarni chiqaradigan funksiyali klass yarating.
Masalan (10,20) orasida 11 “unique” emas. 10 12 13 14 15 16 17 18 19 20 lar unique.
Unique unique = new Unique(20,20);
unique.numbers();
Input:
Start = 10, Stop = 20
Output:
10 12 13 14 15 16 17 18 19 20

4-topshiriq Berilgan N songacha nechta tub son borligini aniqlaydigan funksiyali klass yarating.


Primes primes = new Primes(10);
primes.countPrimes();
Input: 10
Output: 4
Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.

5-topshiriq Perfect Number

Agar berilgan son o`zining musbat bo`luvchilarining yig`indisiga teng bo`lsa bu son “Perfect Number” deyiladi. Berilgan son “Perfect Number” bo`lsa true bo`lmasa false qiymat chiqaradigan funksiyali klass yarating.
PerfectNumber perfect = new PerfectNumber(28);
perfect.checkPerfectNumber();
Input: 28
Output: True
Explanation: 28 = 1 + 2 + 4 + 7 + 14



  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