Muhammad al-xorazmiy nomidagi axborot texnologiyalari universiteti


Download 136.64 Kb.
Sana13.03.2023
Hajmi136.64 Kb.
#1266082
Bog'liq
Barkamol Imomaliyev


MUHAMMAD AL-XORAZMIY NOMIDAGI
AXBOROT TEXNOLOGIYALARI UNIVERSITETI


Telekommunikatsiya texnologiyalari
1-bosqich 431-22-guruh talabasi
Imomaliyev Barkamolning
Dasturlash
fanidan bajargan
mustaqil ishi


Topshirdi: Imomaliyev Barkamol
Toshkent 2023
1. Kafedrada ishlovchi o’qituvchilarning familiyasi, ismi va telefoni (agar bo’lsa bo’lmasa “yo’q” yoziladi) to’g’risida ma’lumot berilgan. Telefoni yo’q bo’lgan o’qituvchilar ro’yxatinini chop etuvchi dastur tuzing.
package mnb;

import java.util.List;
import java.util.ArrayList;

public class Main {
public static void main(String[] args) {
List list=new ArrayList<>();
list.add(new Kafedra("Asror","Valiyev","94 143 23 32"));
list.add(new Kafedra("Bahrom","Nabiyev","94 943 73 32"));
list.add(new Kafedra("Akmal","Sherboyev","93 143 23 02"));
list.add(new Kafedra("Shermat","Toshmatov",""));
list.add(new Kafedra("Nodir","Qo'ziyev","94 873 93 32"));
list.add(new Kafedra("Saman","Sherboy",""));

System.out.println("Kafedrada ishlovchi tel raqami yo;q o'qituvchilar ");
for (Kafedra l:list) {
if(l.getPhoneNumber().length()==0){
System.out.println(l);
} }
}
public static class Kafedra {
private String surname;
private String name;
private String phoneNumber;

public Kafedra(String name, String surname, String phoneNumber) {
this.phoneNumber=phoneNumber;
this.name=name;
this.surname=surname;
}

@Override
public String toString() {
return "Kafedra{" +
"surname='" + surname + '\'' +
", name='" + name + '\'' +
", phoneNumber='" + phoneNumber + '\'' +
'}';
}
public String getSurname() {
return surname;
}
public String getName() {
return name;
}
public String getPhoneNumber() {
return phoneNumber;
}
}
}

2.

Kitob (Avtor, kitob nomi, nashriyot, sahifalar soni)

Nashriyot

package mnb;

import java.util.List;
import java.util.ArrayList;

public class Main {
public static void main(String[] args) {
Listlist=new ArrayList<>();
list.add(new Book("Alisher","Olg'a","No'mer odin",234));
list.add(new Book("Valisher","Olg'a","No'mer odin",294));
list.add(new Book("Dalisher","Olg'a","No'mer odin",594));
list.add(new Book("G'anisher","Olg'a","No'mer odin",894));

System.out.println(list);

}


public static class Book {
private String avtor;
private String bookName;
private String nashriyot;
private int sahifalar_soni;

public Book(String avtor, String bookName, String nashriyot, int sahifalar_soni) {
this.avtor = avtor;
this.bookName = bookName;
this.nashriyot = nashriyot;
this.sahifalar_soni = sahifalar_soni;
}

@Override
public String toString() {
return "Book{" +
"avtor='" + avtor + '\'' +
", bookName='" + bookName + '\'' +
", nashriyot='" + nashriyot + '\'' +
", sahifalar_soni=" + sahifalar_soni +
'}';
}

public String getAvtor() {
return avtor;
}

public String getBookName() {
return bookName;
}

public String getNashriyot() {
return nashriyot;
}

public int getSahifalar_soni() {
return sahifalar_soni;
}
}


}
[Book{avtor='Alisher', bookName='Olg'a', nashriyot='No'mer odin', sahifalar_soni=234}, Book{avtor='Valisher', bookName='Olg'a', nashriyot='No'mer odin', sahifalar_soni=294}, Book{avtor='Dalisher', bookName='Olg'a', nashriyot='No'mer odin', sahifalar_soni=594}, Book{avtor='G'anisher', bookName='Olg'a', nashriyot='No'mer odin', sahifalar_soni=894}]

Process finished with exit code 0
Download 136.64 Kb.

Do'stlaringiz bilan baham:




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