Feature qlsv save txt - #10
Conversation
| System.out.println("Nhập địa chỉ:"); | ||
| diaChi = keyboard.nextLine(); | ||
| System.out.println("Nhập tuổi:"); | ||
| tuoi = keyboard.nextInt(); |
There was a problem hiding this comment.
dùng keyboard.nextLine(), để tránh bị lỗi như a post ảnh
| System.out.println("Nhập số chứng minh thư"); | ||
| soCmt = keyboard.nextInt(); | ||
| System.out.println("Nhập số điểm Ielts"); | ||
| diemIelts = keyboard.nextFloat(); |
There was a problem hiding this comment.
tương tự như nhập tuổi, nhập bằng string, và sau đó parse sang double
There was a problem hiding this comment.
nói chung tất cả đều dùng string và sau đó parse sang kiểu dữ liệu tương ứng
There was a problem hiding this comment.
Integer.parseInt(keyboard.nextLine()); thay cho keyboard.nextInt() va tuong tu cho cac field khac phai khong a?
| int tuoi; | ||
| int soCmt; | ||
| float diemIelts; | ||
| Scanner keyboard = new Scanner(System.in); |
There was a problem hiding this comment.
thay vì tạo mới đối tượng keyboard, thì e dùng đối tượng đã được tạo, làm tham số truyền vào cho hàm này
There was a problem hiding this comment.
Em vừa fix lại rồi ạ.
| System.out.println("Bạn có muốn thực hiện lại không? Yes/ No?"); | ||
| repeat = keyboard.nextLine(); | ||
|
|
||
| } while (repeat.equals("Yes") == true); |
There was a problem hiding this comment.
không cần check == true nữa
| } | ||
| } | ||
|
|
||
| private static void editSinhVien() { |
There was a problem hiding this comment.
edit xong chưa save vào txt file
There was a problem hiding this comment.
em add saveData() vào rồi ạ.
|
|
||
| } | ||
|
|
||
| int sizes = 0; |
| } | ||
|
|
||
| int sizes = 0; | ||
| private static Scanner x; |
There was a problem hiding this comment.
nên để trong hàm, vì cái này chỉ phục vụ hàm dưới, nên ko cần để phạm vi bên ngoài. đặt tên có nghĩa
| } | ||
|
|
||
| // Check an element is null or not | ||
| private static boolean isNotNull(SinhVien x) { |
There was a problem hiding this comment.
có thể ngắn gọn dòng code return sv == null ? false : true;
đặt tên biến có nghĩa
|
|
||
| // Check an element is null or not | ||
| private static boolean isNotNull(SinhVien x) { | ||
| return x == null ? false : true; |
save txt to develop