Không xuất ra được class - code Java

package LAB5_tienlcph26838;

/**
 *
 * @author AD
 */
public class QuanLySV {

    private String masv;
    private String hotensv;
    private String emailsv;
    private int sdt;
    private int CMND;

    public QuanLySV() {
    }

    public QuanLySV(String masv, String hotensv, String emailsv, int sdt, int CMND) {
        this.masv = masv;
        this.hotensv = hotensv;
        this.emailsv = emailsv;
        this.sdt = sdt;
        this.CMND = CMND;
    }

    public String getMasv() {
        return masv;
    }

    public void setMasv(String masv) {
        this.masv = masv;
    }

    public String getHotensv() {
        return hotensv;
    }

    public void setHotensv(String hotensv) {
        this.hotensv = hotensv;
    }

    public String getEmailsv() {
        return emailsv;
    }

    public void setEmailsv(String emailsv) {
        this.emailsv = emailsv;
    }

    public int getSdt() {
        return sdt;
    }

    public void setSdt(int sdt) {
        this.sdt = sdt;
    }

    public int getCMND() {
        return CMND;
    }

    public void setCMND(int CMND) {
        this.CMND = CMND;
    }

    public void xuatsv() {
        System.out.println("+-----------------QUAN LY SINH VIEN---------------------+");
        System.out.printf("      Ma sinh vien     :  %s",masv);
        System.out.printf("      Ho ten sinh vien :  %s",hotensv);
        System.out.printf("      Dia chi email    :  %s",emailsv);
        System.out.printf("      So dien thoai    :  %s", sdt);
        System.out.printf("      So CMND          :  %s", CMND);
        System.out.println("+--------------------------------------------------------+");
    }
}







/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package LAB5_tienlcph26838;

import java.util.ArrayList;
import java.util.Scanner;

/**
 *
 * @author AD
 */
public class DsSinhVien {

    private final ArrayList<QuanLySV> list = new ArrayList<>();

    QuanLySV _qlsv;

    String getIntputValue(String moinhap) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Moi nhap " + moinhap);
        return scanner.nextLine();
    }

    public void nhapdssv() {
        String nhaptiep;
        Scanner scanner = new Scanner(System.in);
        while (true) {

            _qlsv = new QuanLySV();
            _qlsv.setMasv(getIntputValue(" ma sinh vien : "));
            _qlsv.setHotensv(getIntputValue("ho va ten : "));
            _qlsv.setEmailsv(getIntputValue("dia chi email : "));
            _qlsv.setSdt(Integer.parseInt(getIntputValue("so dien thoai : ")));
            _qlsv.setCMND(Integer.parseInt(getIntputValue("so CMND : ")));

            System.out.println("The bay gio ban muon nhap tiep hay nhu the nao ? Bam 0 de ket thuc ");
            nhaptiep = scanner.nextLine();
            if (nhaptiep.equalsIgnoreCase("0")) {
                break;
            }
        }
    }

    void xuatdssv() {
        if (list.isEmpty()) {  // kiem tra neu chuong trinh rỗng thi in ra va thoat 
            System.out.println("Co gi dau ma xuat !!");
            return;
        } 
            for (QuanLySV quanLySV : list) {
                quanLySV.xuatsv();
            }
        }

    

    public void timkiemsv() {

    }

    public void menusv() {
        int chon = 0;
        Scanner scanner = new Scanner(System.in);
        DsSinhVien dssv = new DsSinhVien();
        do {
            System.out.println("                                            ");
            System.out.println("+----------------Menu chuong trinh--------------+");
            System.out.println("|        1. Nhap danh sach sinh vien            |");
            System.out.println("|        2. Xuat danh sach sinh vien            |");
            System.out.println("|        3. Tim sinh vien theo ma SV            |");
            System.out.println("|        4. Tim sinh vien va cat nhat ma SV     |");
            System.out.println("|        5. Xoa sinh vien theo so CMND          |");
            System.out.println("|        6. Sap xep sinh vien ten giam dan      |");
            System.out.println("|        0. Thoat                               |");
            System.out.println("+-----------------------------------------------+");
            System.out.print("Moi nhap lua chon :");
            chon = scanner.nextInt();
            switch (chon) {
                case 1 -> {
                    nhapdssv();
                    break;
                }

                case 2 -> {
                    xuatdssv();
                    break;
                }
                case 3 -> {
                    timkiemsv();
                    break;
                }
                case 4 -> {

                    break;
                }
                case 5 -> {

                    break;
                }
                case 6 -> {

                    break;
                }
                case 0 -> {

                    break;
                }

                default ->
                    throw new AssertionError();
            }
        } while (chon != 0);
    }
}



package LAB5_tienlcph26838;

/**
 *
 * @author AD
 */
public class MainSinhVien {

    public static void main(String[] args) {
        DsSinhVien ds = new DsSinhVien();
        ds.menusv();
    }
}

A post was merged into an existing topic: Không xuất được class - Java

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?