Guruh talabasi Abduvohid Ergashev package topshiriq3
Download 42.79 Kb.
|
3-topshiriq
314-18 guruh talabasi Abduvohid Ergashev package topshiriq3; import java.util.Scanner; public class topshiriq3 { public static void main(String[] args) { sinf sinf = new sinf(); Scanner in = new Scanner(System.in); System.out.print("Ma'lumotalrni kiriting: \nBirinchi son : "); sinf.setA(in.nextInt()); System.out.print("Ikkinchi son : "); sinf.setB(in.nextInt()); System.out.print("Uchinchi son : "); sinf.setC(in.nextInt()); System.out.print("To'rtinchi son : "); sinf.setD(in.nextInt()); System.out.println(sinf.toString()); System.out.println("Maksimal son : " + sinf.max()); } } Yaratilgan sinf package topshiriq3; public class sinf { int a; int b; int c; int d; public int getA() { return a; } public void setA(int a) { this.a = a; } public int getB() { return b; } public void setB(int b) { this.b = b; } public int getC() { return c; } public void setC(int c) { this.c = c; } public int getD() { return d; } public void setD(int d) { this.d = d; } @Override public String toString() { return "sinf{" + "a=" + a + ", b=" + b + ", c=" + c + ", d=" + d + '}'; } public int max(){ int [] a = {this.a, this.b, this.c, this.d}; int max = a[0]; for (int i=0; i<4; i++){ if (max} return max; } } Natija:
Download 42.79 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling