package des02;
import java.util.Scanner;
public class Nguoi {
Scanner ok = new Scanner(System.in);
String hoten;
int tuoi, namsinh;
public String getHoten() {
return hoten;
}
public int getTuoi() {
return tuoi;
}
public void nhap() {
System.out.print("--------------Ho ten :");
hoten = ok.next();
System.out.print("--------------Tuoi :");
tuoi = ok.nextInt();
}
public Nguoi() {
}
public void xuat() {
System.out.println("Ho ten :" + getHoten());
System.out.println("Tuoi :" + getTuoi());
}
}
*****class chinh*****
package des02;
import java.util.Scanner;
public class khupho extends Nguoi {
public static Nguoi mangtt[][] = new Nguoi[10][10];
public static void main(String args[]) {
Scanner ok = new Scanner(System.in);
int m, n;
System.out.print(">>So ho gia dinh :");
m = ok.nextInt();
int dem[] = new int[99];
for (int j = 0; j < m; j++) {
System.out.println(">>>>>>Nhap thong tin ho thu " + (j + 1));
{
System.out.print(">>>>>>>>>>>>>So nguoi trong ho :");
n = ok.nextInt();
dem[j] = n;
for (int i = 0; i < n; i++) {
mangtt[j][i] = new Nguoi();
System.out.println("Nguoi thu " + (i + 1));
mangtt[j][i].nhap();
}
}
}
for (int i = 0; i < m; i++) {
System.out.println("*******Thong tin nha so " + (i + 1)+"********("+(dem[i])+" nguoi )");
for (int j = 0; j < dem[i]; j++) {
mangtt[i][j].xuat();
}
}
}
}
----lien he voi minh de biet them chi tiet----- />