fork download
  1. package topica.test;
  2.  
  3.  
  4. import java.util.ArrayList;
  5. import java.util.Scanner;
  6.  
  7.  
  8.  
  9. import topica.io.function;
  10. import topica.moduel.CanBo;
  11. import topica.moduel.GiangVien;
  12. import topica.moduel.NhanVien;
  13.  
  14. public class Main {
  15.  
  16.  
  17.  
  18.  
  19. static Scanner sc = new Scanner(System.in);
  20. static String pathName = "C:\\Users\\ta\\Desktop\\javaProgram\\NhanVien";
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. public static void menu()
  28. {
  29. System.out.println("!---------------------------------------!");
  30. System.out.println("!1.Thêm nhân viên-----------------------!");
  31. System.out.println("!2.Hiển thị danh sách-------------------!");
  32. System.out.println("!3.Tìm kiếm theo ID---------------------!");
  33. System.out.println("!4.Sắp xếp danh sách theo 1:Tên , 2:Tuổi!");
  34. System.out.println("!5.Sửa khách hàng theo ID---------------!");
  35. System.out.println("!6.Xóa khách hàng theo ID---------------!");
  36. System.out.println("!7.Biến đổi sang map--------------------!");
  37. System.out.println("!7.Kết thúc chương trình----------------!");
  38. System.out.println("!---------------------------------------!");
  39. }
  40.  
  41. public static void menu00()
  42. {
  43. System.out.println("!------------------!");
  44. System.out.println("!1.Thêm giảng viên-!");
  45. System.out.println("!2.Thêm cán bộ-----!");
  46. System.out.println("!------------------!");
  47. boolean flag = true;
  48. do {
  49. System.out.print("Nhập loại nhân viên của bạn : ");
  50. int choice = Integer.parseInt(sc.nextLine());
  51.  
  52. switch (choice) {
  53. case 1:
  54. {
  55. themgiangvien();
  56. flag = false;
  57. break;
  58.  
  59. }
  60.  
  61. case 2:
  62. {
  63. themcanbo();
  64. flag = false;
  65. break;
  66.  
  67. }
  68.  
  69.  
  70.  
  71. default:
  72. {
  73. System.out.println("Nhập sai vui lòng nhập lại !");
  74. }
  75. }
  76.  
  77.  
  78. } while (flag);
  79.  
  80.  
  81. }
  82.  
  83.  
  84. private static void themcanbo() {
  85. // TODO Auto-generated method stub
  86.  
  87. System.out.println("!-------------Nhập thông tin cán bộ-------------!");
  88. NhanVien nv = new GiangVien();
  89. nv.inputInformation();
  90.  
  91. System.out.println("!------------------Kết thúc nhập-----------------!");
  92.  
  93. boolean flag = function.addnhanvien(nv, pathName);
  94. if(flag)
  95. {
  96. System.out.println("Ghi thành công !");
  97. }
  98. else
  99. {
  100. System.out.println("Lỗi !");
  101. }
  102.  
  103.  
  104. }
  105.  
  106.  
  107. private static void themgiangvien() {
  108. // TODO Auto-generated method stub
  109.  
  110. System.out.println("!-------------Nhập thông tin giảng viên------------!");
  111. NhanVien nv = new CanBo();
  112. nv.inputInformation();
  113.  
  114. System.out.println("!------------------Kết thúc nhập-----------------!");
  115.  
  116.  
  117. boolean flag = function.addnhanvien(nv, pathName);
  118. if(flag)
  119. {
  120. System.out.println("Ghi thành công !");
  121. }
  122. else
  123. {
  124. System.out.println("Ghi thất bại !");
  125. }
  126.  
  127.  
  128. }
  129.  
  130.  
  131.  
  132.  
  133.  
  134. public static void main(String[] args) {
  135. // TODO Auto-generated method stub
  136. menu();
  137.  
  138. boolean flag = true;
  139.  
  140.  
  141. do {
  142.  
  143. System.out.print("Nhập lựa chọn của bạn : ");
  144. int choice = Integer.parseInt(sc.nextLine());
  145.  
  146. switch (choice) {
  147. case 1:
  148. {
  149.  
  150. menu00();
  151. break;
  152. }
  153.  
  154. case 2 :
  155. {
  156. DisplayList();
  157. break;
  158. }
  159.  
  160. case 3 :
  161. {
  162. find();
  163. break;
  164. }
  165.  
  166. case 4 :
  167. {
  168. sapxep();
  169. break;
  170. }
  171. case 5 :
  172. {
  173. suathongtin();
  174. break;
  175. }
  176.  
  177. case 6 :
  178. {
  179. xoathongtin();
  180. break;
  181. }
  182.  
  183.  
  184. case 7 :
  185. {
  186. System.out.println("Kết thúc chương trình !");
  187. flag = false;
  188. break;
  189. }
  190.  
  191.  
  192.  
  193. default:
  194. {
  195. System.out.println("Nhập sai vui lòng nhập lại !");
  196.  
  197. }
  198.  
  199.  
  200. }
  201.  
  202.  
  203. } while (flag);
  204.  
  205. }
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212. private static void xoathongtin() {
  213. // TODO Auto-generated method stub
  214. ArrayList<NhanVien> arr = function.docFile(pathName);
  215. System.out.print("Nhập ID cần xóa : ");
  216. String s = sc.nextLine();
  217. if(function.findID(s, pathName)!=-1)
  218. {
  219. arr.remove(function.findID(s, pathName));
  220. function.luuFile(arr, pathName);
  221. }
  222. else
  223. {
  224. System.out.println("Không tìm thấy ID");
  225. }
  226.  
  227.  
  228.  
  229. }
  230.  
  231. private static void suathongtin() {
  232. // TODO Auto-generated method stub
  233. ArrayList<NhanVien> arr = function.docFile(pathName);
  234. System.out.print("Nhập mã nhân viên cần thay đổi : ");
  235. String s = sc.nextLine();
  236. int vt = function.findID(s, pathName);
  237. if(vt!=-1)
  238. {
  239. System.out.println("!------------!");
  240. System.out.println("!1.Cán bộ----!");
  241. System.out.println("!2.Giảng viên!");
  242. System.out.println("!------------!");
  243. System.out.print("Nhập lựa chọn của bạn : ");
  244. int choice = Integer.parseInt(sc.nextLine());
  245.  
  246.  
  247. switch (choice) {
  248. case 1:
  249. {
  250. GiangVien gv = new GiangVien();
  251. gv.inputInformation();
  252. arr.set(vt, gv);
  253. function.luuFile(arr, pathName);
  254.  
  255. break;
  256.  
  257. }
  258.  
  259. case 2:
  260. {
  261. CanBo cb = new CanBo();
  262. cb.inputInformation();
  263. arr.set(vt, cb);
  264. function.luuFile(arr, pathName);
  265. break;
  266.  
  267. }
  268.  
  269. default:
  270. break;
  271. }
  272.  
  273.  
  274.  
  275. }
  276.  
  277. else
  278. {
  279. System.out.println("Không tìm thấy mã !");
  280. }
  281.  
  282. }
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289. private static void sapxep() {
  290. // TODO Auto-generated method stub
  291. function.comparato(pathName);
  292.  
  293.  
  294.  
  295. }
  296.  
  297.  
  298.  
  299. private static void find() {
  300. // TODO Auto-generated method stub
  301. System.out.print("Nhập vào ID cần tìm : ");
  302. String str = sc.nextLine();
  303. NhanVien nv = function.find(str, pathName);
  304. if(nv==null)
  305. {
  306. System.out.println("Không tìm thấy ID");
  307.  
  308. }
  309. else
  310. {
  311. System.out.println(nv.toString());
  312. }
  313. }
  314.  
  315.  
  316.  
  317.  
  318. private static void DisplayList() {
  319. // TODO Auto-generated method stub
  320. ArrayList<NhanVien> arr = function.docFile(pathName);
  321. for (NhanVien nhanVien : arr) {
  322. System.out.println(nhanVien.toString());
  323. }
  324.  
  325.  
  326.  
  327.  
  328. }
  329.  
  330. }
  331.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:9: error: package topica.io does not exist
import topica.io.function;
                ^
Main.java:10: error: package topica.moduel does not exist
import topica.moduel.CanBo;
                    ^
Main.java:11: error: package topica.moduel does not exist
import topica.moduel.GiangVien;
                    ^
Main.java:12: error: package topica.moduel does not exist
import topica.moduel.NhanVien;
                    ^
Main.java:88: error: cannot find symbol
		NhanVien nv = new GiangVien();
		^
  symbol:   class NhanVien
  location: class Main
Main.java:88: error: cannot find symbol
		NhanVien nv = new GiangVien();
		                  ^
  symbol:   class GiangVien
  location: class Main
Main.java:93: error: cannot find symbol
		boolean flag = function.addnhanvien(nv, pathName);
		               ^
  symbol:   variable function
  location: class Main
Main.java:111: error: cannot find symbol
		NhanVien nv = new CanBo();
		^
  symbol:   class NhanVien
  location: class Main
Main.java:111: error: cannot find symbol
		NhanVien nv = new CanBo();
		                  ^
  symbol:   class CanBo
  location: class Main
Main.java:117: error: cannot find symbol
		boolean flag = function.addnhanvien(nv, pathName);
		               ^
  symbol:   variable function
  location: class Main
Main.java:214: error: cannot find symbol
		ArrayList<NhanVien> arr = function.docFile(pathName);
		          ^
  symbol:   class NhanVien
  location: class Main
Main.java:214: error: cannot find symbol
		ArrayList<NhanVien> arr = function.docFile(pathName);
		                          ^
  symbol:   variable function
  location: class Main
Main.java:217: error: cannot find symbol
		if(function.findID(s, pathName)!=-1)
		   ^
  symbol:   variable function
  location: class Main
Main.java:219: error: cannot find symbol
			arr.remove(function.findID(s, pathName));
			           ^
  symbol:   variable function
  location: class Main
Main.java:220: error: cannot find symbol
			function.luuFile(arr, pathName);
			^
  symbol:   variable function
  location: class Main
Main.java:233: error: cannot find symbol
		ArrayList<NhanVien> arr = function.docFile(pathName);
		          ^
  symbol:   class NhanVien
  location: class Main
Main.java:233: error: cannot find symbol
		ArrayList<NhanVien> arr = function.docFile(pathName);
		                          ^
  symbol:   variable function
  location: class Main
Main.java:236: error: cannot find symbol
		int vt = function.findID(s, pathName);
		         ^
  symbol:   variable function
  location: class Main
Main.java:250: error: cannot find symbol
				GiangVien gv = new GiangVien();
				^
  symbol:   class GiangVien
  location: class Main
Main.java:250: error: cannot find symbol
				GiangVien gv = new GiangVien();
				                   ^
  symbol:   class GiangVien
  location: class Main
Main.java:253: error: cannot find symbol
				function.luuFile(arr, pathName);
				^
  symbol:   variable function
  location: class Main
Main.java:261: error: cannot find symbol
				CanBo cb = new CanBo();
				^
  symbol:   class CanBo
  location: class Main
Main.java:261: error: cannot find symbol
				CanBo cb = new CanBo();
				               ^
  symbol:   class CanBo
  location: class Main
Main.java:264: error: cannot find symbol
				function.luuFile(arr, pathName);
				^
  symbol:   variable function
  location: class Main
Main.java:291: error: cannot find symbol
		function.comparato(pathName);
		^
  symbol:   variable function
  location: class Main
Main.java:303: error: cannot find symbol
		  NhanVien nv = function.find(str, pathName);
		  ^
  symbol:   class NhanVien
  location: class Main
Main.java:303: error: cannot find symbol
		  NhanVien nv = function.find(str, pathName);
		                ^
  symbol:   variable function
  location: class Main
Main.java:320: error: cannot find symbol
		ArrayList<NhanVien> arr = function.docFile(pathName);
		          ^
  symbol:   class NhanVien
  location: class Main
Main.java:320: error: cannot find symbol
		ArrayList<NhanVien> arr = function.docFile(pathName);
		                          ^
  symbol:   variable function
  location: class Main
Main.java:321: error: cannot find symbol
		for (NhanVien nhanVien : arr) {
		     ^
  symbol:   class NhanVien
  location: class Main
30 errors
stdout
Standard output is empty