1. Sportchi: Familiya-ismi, yoshi, jinsi, bo„yi, massasi, sport turi. Sportchi sinfining ob‟ektini yarating va uning barcha komponentalariga qiymatlar bering. Yaratilgan ob‟ekt ma‟lumotlarini ekranga chiqaring
Download 28.94 Kb.
|
O`ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI Dasturlash uslublari va paradigmalari fanidan bajargan 5-topshiriq Bajardi: Saidov Og’abek Tekshirdi: Shoazizova Madina 1-variant 1. Sportchi: Familiya-ismi, yoshi, jinsi, bo„yi, massasi, sport turi. Sportchi sinfining ob‟ektini yarating va uning barcha komponentalariga qiymatlar bering. Yaratilgan ob‟ekt ma‟lumotlarini ekranga chiqaring. Sportchi sinfi: package uz.ogabek.dev.task4; public class Sportchi { private String firstname; private String lastname; private int age; private String gender; private double height; private double weight; private String type; public Sportchi() { } public Sportchi(String firstname, String lastname, int age, String gender, double height, double weight, String type) { this.firstname = firstname; this.lastname = lastname; this.age = age; this.gender = gender; this.height = height; this.weight = weight; this.type = type; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public String toString() { return "Sportchi{" + "firstname='" + firstname + '\'' + ", lastname='" + lastname + '\'' + ", age=" + age + ", gender='" + gender + '\'' + ", height=" + height + ", weight=" + weight + ", type='" + type + '\'' + '}'; } } Asosiy sinf: package uz.ogabek.dev.task4; public class Main { public static void main(String[] args) { Sportchi sportchi = new Sportchi(); sportchi.setFirstname("Hasanboy"); sportchi.setLastname("Dustmatov"); sportchi.setAge(25); sportchi.setGender("Erkak"); sportchi.setHeight(1.67); sportchi.setWeight(63.5); sportchi.setType("Bokschi"); System.out.println(sportchi); } } Natija: Sportchi{firstname='Hasanboy', lastname='Dustmatov', age=25, gender='Erkak', height=1.67, weight=63.5, type='Bokschi'} Download 28.94 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling