Bajardi: Saidov S
Download 204.53 Kb.
|
Code:
package paradigm.amaliy5; public class Chars { public static void main(String[] args) { char[] chars = {'a', 'b', 'c', 'A', 'B', 'e', 'O', 'P', 'o', 'Q'}; int letter1 = 0; int letter2 = 0; for (char aChar : chars) { if (aChar <= 90) { letter1++; } else { letter2++; } } System.out.println("katta xarflar soni: " + letter1); System.out.println("kichik xarflar soni: " + letter2); } } Natija: Kredit tizimida darsga talabalar har xil guruxlardan kelganligi uchun bir birlarini yaxshi tanishmaydi. Shuning uchun o‘zining o‘rniga boshqa fanni yaxshi biladigan or‘tog‘ini kirtib yuboradi. Imtixonlar kompyuterda o‘tkaziladi. Savollarni ochish uchun FIO kiritilgandan keyin, talabaning barmog‘ izlari tekshiriladi. Agar mos kelsa savollar ochiladi. Aks holda ochilmaydi. Imtixonga o‘rtog‘ini uchun kirga begona talabalarni aniqlovchi dastur tuzing. Code: package paradigm.amaliy5; public class Student { private String name; private String surname; private int fingerId; public Student(String name, String surname, int fingerId) { this.name = name; this.surname = surname; this.fingerId = fingerId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public int getFingerId() { return fingerId; } public void setFingerId(String fingerId) { this.fingerId = Integer.parseInt(fingerId); } @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", surname='" + surname + '\'' + ", fingerId='" + fingerId + '\'' + '}'; } } package paradigm.amaliy5; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class FindStudent { public static void main(String[] args) { Map map.put(123456789, new Student("Nurbek", "Sirojiddinov", 123456789)); Scanner scanner = new Scanner(System.in); System.out.print("Ismni kiriting: "); String name = scanner.next(); System.out.print("Familyani kiriting: "); String surname = scanner.next(); int id = scanner.nextInt(); if (map.containsKey(id)) { System.out.println("Generating questions....."); System.out.println(map); } else { System.out.println("There is no such user!!!"); } } } Natija: a[n][m] massiv elementlarini [-1000; 1000] oraliqdagi tasodifiy sonlar bilan to‘ldiring. Berilgan massiv elementlarining a va b oraliqdagilari sonini toping. Code: package paradigm.amaliy5; import java.util.Arrays; import java.util.Scanner; public class RandomArray { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("massive dagi qatorlar sonini kiriting"); Download 204.53 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling