diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 639900d..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 0e0500a..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Bai1/Bai1/.classpath b/Bai1/Bai1/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai1/Bai1/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai1/Bai1/.project b/Bai1/Bai1/.project
new file mode 100644
index 0000000..c0b6442
--- /dev/null
+++ b/Bai1/Bai1/.project
@@ -0,0 +1,28 @@
+
+
+ Bai1
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272454
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai1/Bai1/.settings/org.eclipse.jdt.core.prefs b/Bai1/Bai1/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai1/Bai1/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai1/Bai1/bin/Class/PhanSo.class b/Bai1/Bai1/bin/Class/PhanSo.class
new file mode 100644
index 0000000..f4ab430
Binary files /dev/null and b/Bai1/Bai1/bin/Class/PhanSo.class differ
diff --git a/Bai1/Bai1/bin/Test/TestClass.class b/Bai1/Bai1/bin/Test/TestClass.class
new file mode 100644
index 0000000..be5aed6
Binary files /dev/null and b/Bai1/Bai1/bin/Test/TestClass.class differ
diff --git a/Bai1/Bai1/src/Class/PhanSo.java b/Bai1/Bai1/src/Class/PhanSo.java
new file mode 100644
index 0000000..d68a2c8
--- /dev/null
+++ b/Bai1/Bai1/src/Class/PhanSo.java
@@ -0,0 +1,114 @@
+package Class;
+
+import java.util.Scanner;
+
+public class PhanSo {
+ // thuoc tinh
+ private int tuSo;
+ private int mauSo;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public PhanSo() {
+ tuSo = 0;
+ mauSo = 1;
+ }
+
+ // ham khoi tao co doi so
+ public PhanSo(int tuSo, int mauSo) {
+ this.tuSo = tuSo;
+ this.mauSo = mauSo;
+ }
+
+ // ham nhap phan so
+ public void nhapPS(Scanner sc) {
+ int a;
+ int b;
+
+ do {
+ System.out.print("\tNhap vao tu so: ");
+ a = sc.nextInt();
+
+ System.out.print("\tNhap vao mau so: ");
+ b = sc.nextInt();
+
+ // kiem tra
+ if (b == 0) {
+ System.out.println("Mau so khong duoc bang 0. Hay nhap lai!");
+ } else {
+ tuSo = a;
+ mauSo = b;
+ }
+ } while (b == 0);
+ }
+
+ // ham hien thi
+ public void hienThiPS() {
+ if (tuSo * mauSo < 0) {
+ System.out.println("\t-" + Math.abs(tuSo) + "/" + Math.abs(mauSo));
+ } else {
+ System.out.println("\t" + Math.abs(tuSo) + "/" + Math.abs(mauSo));
+ }
+ }
+
+ // ham cong
+ public PhanSo congPS(PhanSo ps2) {
+ int a = tuSo * ps2.mauSo + ps2.tuSo * mauSo;
+ int b = mauSo * ps2.mauSo;
+
+ return new PhanSo(a, b);
+ }
+
+ // ham tru
+ public PhanSo truPS(PhanSo ps2) {
+ int a = tuSo * ps2.mauSo - ps2.tuSo * mauSo;
+ int b = mauSo * ps2.mauSo;
+
+ return new PhanSo(a, b);
+ }
+
+ // ham nhan
+ public PhanSo nhanPS(PhanSo ps2) {
+ int a = tuSo * ps2.tuSo;
+ int b = mauSo * ps2.mauSo;
+
+ return new PhanSo(a, b);
+ }
+
+ // ham chia
+ public PhanSo chiaPS(PhanSo ps2) {
+ int a = tuSo * ps2.mauSo;
+ int b = mauSo * ps2.tuSo;
+
+ return new PhanSo(a, b);
+ }
+
+ // ham tim uscln
+ private int timUSCLN(int a, int b) {
+ int r = a % b;
+
+ while (r != 0) {
+ a = b;
+ b = r;
+ r = a % b;
+ }
+
+ return b;
+ }
+
+ // ham kiem tra phan so toi gian hay chua
+ public boolean kiemTraToiGian() {
+ if (timUSCLN(tuSo, mauSo) == 1) {
+ return true;
+ }
+ return false;
+ }
+
+ // ham toi gian
+ public void toiGianPS() {
+ int x = timUSCLN(tuSo, mauSo);
+
+ tuSo /= x;
+ mauSo /= x;
+ }
+}
diff --git a/Bai1/Bai1/src/Test/TestClass.java b/Bai1/Bai1/src/Test/TestClass.java
new file mode 100644
index 0000000..a38acdf
--- /dev/null
+++ b/Bai1/Bai1/src/Test/TestClass.java
@@ -0,0 +1,35 @@
+package Test;
+
+import java.util.Scanner;
+
+import Class.PhanSo;
+
+public class TestClass {
+
+ public static void main(String[] args) {
+ Scanner sc=new Scanner(System.in);
+ PhanSo ps1=new PhanSo();
+ PhanSo ps2=new PhanSo();
+ PhanSo psTong =new PhanSo();
+
+ // nhap phan so
+ System.out.println("Nhap vao phan so thu nhat:");
+ ps1.nhapPS(sc);
+ System.out.println("Nhap vao phan so thu hai:");
+ ps2.nhapPS(sc);
+
+ // tinh tong 2 phan so
+ psTong=ps1.congPS(ps2);
+
+ // hien thi phan so
+ System.out.println("\nPhan so thu nhat la:");
+ ps1.hienThiPS();
+ System.out.println("\nPhan so thu hai la:");
+ ps2.hienThiPS();
+ System.out.println("\nPhan so tong la:");
+ psTong.hienThiPS();
+
+ sc.close();
+ }
+
+}
diff --git a/Bai10/Bai10/.classpath b/Bai10/Bai10/.classpath
new file mode 100644
index 0000000..4f2c72b
--- /dev/null
+++ b/Bai10/Bai10/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Bai10/Bai10/.project b/Bai10/Bai10/.project
new file mode 100644
index 0000000..cc55708
--- /dev/null
+++ b/Bai10/Bai10/.project
@@ -0,0 +1,28 @@
+
+
+ Bai10
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272482
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai10/Bai10/.settings/org.eclipse.jdt.core.prefs b/Bai10/Bai10/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai10/Bai10/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai10/Bai10/bin/BuildClass/BienLai.class b/Bai10/Bai10/bin/BuildClass/BienLai.class
new file mode 100644
index 0000000..f78d915
Binary files /dev/null and b/Bai10/Bai10/bin/BuildClass/BienLai.class differ
diff --git a/Bai10/Bai10/bin/BuildClass/KhachHang.class b/Bai10/Bai10/bin/BuildClass/KhachHang.class
new file mode 100644
index 0000000..726f6db
Binary files /dev/null and b/Bai10/Bai10/bin/BuildClass/KhachHang.class differ
diff --git a/Bai10/Bai10/bin/BuildClass/QuanLy.class b/Bai10/Bai10/bin/BuildClass/QuanLy.class
new file mode 100644
index 0000000..f1b1d2a
Binary files /dev/null and b/Bai10/Bai10/bin/BuildClass/QuanLy.class differ
diff --git a/Bai10/Bai10/bin/UseClass/Using.class b/Bai10/Bai10/bin/UseClass/Using.class
new file mode 100644
index 0000000..9c5c7ee
Binary files /dev/null and b/Bai10/Bai10/bin/UseClass/Using.class differ
diff --git a/Bai10/Bai10/src/BuildClass/BienLai.java b/Bai10/Bai10/src/BuildClass/BienLai.java
new file mode 100644
index 0000000..135a20a
--- /dev/null
+++ b/Bai10/Bai10/src/BuildClass/BienLai.java
@@ -0,0 +1,50 @@
+package BuildClass;
+
+import java.util.Scanner;
+
+public class BienLai extends KhachHang {
+ // Thuoc tinh
+ private int chiSoMoi;
+ private int chiSoCu;
+ private double tien;
+
+ // Phuong thuc
+ // Ham khoi tao khong doi so
+ public BienLai() {
+
+ }
+
+ // Ham khoi tao co doi so
+ public BienLai(int chiSoMoi, int chiSoCu, double tien) {
+ this.chiSoMoi = chiSoMoi;
+ this.chiSoCu = chiSoCu;
+ this.tien = tien;
+ }
+
+ public BienLai(String tenChuHo, int chiSoMoi, int chiSoCu, double tien) {
+ this.tenChuHo = tenChuHo;
+ this.chiSoMoi = chiSoMoi;
+ this.chiSoCu = chiSoCu;
+ this.tien = tien;
+ }
+
+ // Ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap chi so moi: ");
+ chiSoMoi = sc.nextInt();
+ sc.nextLine();
+ System.out.print("\tNhap chi so cu: ");
+ chiSoCu = sc.nextInt();
+ sc.nextLine();
+ tien = (chiSoMoi - chiSoCu) * 750;
+ }
+
+ // Ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tChi so moi: " + chiSoMoi);
+ System.out.println("\tChi so cu: " + chiSoCu);
+ System.out.println("\tTien: : " + tien);
+ }
+}
diff --git a/Bai10/Bai10/src/BuildClass/KhachHang.java b/Bai10/Bai10/src/BuildClass/KhachHang.java
new file mode 100644
index 0000000..461f780
--- /dev/null
+++ b/Bai10/Bai10/src/BuildClass/KhachHang.java
@@ -0,0 +1,41 @@
+package BuildClass;
+
+import java.util.Scanner;
+
+public class KhachHang {
+ // Thuoc tinh
+ protected String tenChuHo;
+ protected int soNha;
+ protected String maCongTo;
+
+ // Phuong thuc
+ // Ham khoi tao khong doi so
+ public KhachHang() {
+
+ }
+
+ // Ham khoi tao co doi so
+ public KhachHang(String tenChuHo, int soNha, String maCongTo) {
+ this.tenChuHo = tenChuHo;
+ this.soNha = soNha;
+ this.maCongTo = maCongTo;
+ }
+
+ // Ham nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ten chu ho: ");
+ tenChuHo = sc.nextLine();
+ System.out.print("\tNhap so nha: ");
+ soNha = sc.nextInt();
+ sc.nextLine();
+ System.out.print("\tNhap ma cong to: ");
+ maCongTo = sc.nextLine();
+ }
+
+ // Hm hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tTen chu ho: " + tenChuHo);
+ System.out.println("\tSo nha: " + soNha);
+ System.out.println("\tMa cong to: " + maCongTo);
+ }
+}
diff --git a/Bai10/Bai10/src/BuildClass/QuanLy.java b/Bai10/Bai10/src/BuildClass/QuanLy.java
new file mode 100644
index 0000000..424fdc2
--- /dev/null
+++ b/Bai10/Bai10/src/BuildClass/QuanLy.java
@@ -0,0 +1,45 @@
+package BuildClass;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class QuanLy {
+ // Thuoc tinh
+ private ArrayList ds;
+
+ // Phuong thuc
+ // Ham khoi tao
+ public QuanLy() {
+ ds = new ArrayList(10);
+ }
+
+ // Ham them bien lai vao danh sach
+ public void themBienLai(BienLai bienLai) {
+ ds.add(bienLai);
+ }
+
+ // Ham nhap danh sach
+ public void nhapDanhSach(Scanner sc) {
+ BienLai bienLai;
+ System.out.print("Nhap vao so luong bien lai: ");
+ int n = sc.nextInt();
+ sc.nextLine();
+ System.out.println("Nhap vao danh sach bien lai:");
+ for (int i = 0; i < n; i++) {
+ System.out.println("Bien lai thu " + (i + 1) + " la:");
+ bienLai = new BienLai();
+ bienLai.nhapThongTin(sc);
+
+ themBienLai(bienLai);
+ }
+ }
+
+ // Ham hien thi danh sach
+ public void hienThiDanhSach() {
+ for (int i = 0; i < ds.size(); i++) {
+ System.out.println("Bien lai thu " + (i + 1) + " la:");
+ ds.get(i).hienThiThongTin();
+ System.out.println();
+ }
+ }
+}
diff --git a/Bai10/Bai10/src/UseClass/Using.java b/Bai10/Bai10/src/UseClass/Using.java
new file mode 100644
index 0000000..943dd83
--- /dev/null
+++ b/Bai10/Bai10/src/UseClass/Using.java
@@ -0,0 +1,21 @@
+package UseClass;
+
+import java.util.Scanner;
+
+import BuildClass.QuanLy;
+
+public class Using {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ QuanLy ql = new QuanLy();
+ ql.nhapDanhSach(sc);
+
+ System.out.println("Danh sach bien lai cua cac ho gia dinh la:");
+ ql.hienThiDanhSach();
+
+ sc.close();
+ }
+
+}
diff --git a/Bai11/Bai11/.classpath b/Bai11/Bai11/.classpath
new file mode 100644
index 0000000..4f2c72b
--- /dev/null
+++ b/Bai11/Bai11/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Bai11/Bai11/.project b/Bai11/Bai11/.project
new file mode 100644
index 0000000..2d865e8
--- /dev/null
+++ b/Bai11/Bai11/.project
@@ -0,0 +1,28 @@
+
+
+ Bai11
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272495
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai11/Bai11/.settings/org.eclipse.jdt.core.prefs b/Bai11/Bai11/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai11/Bai11/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai11/Bai11/bin/BuildClass/VanBan.class b/Bai11/Bai11/bin/BuildClass/VanBan.class
new file mode 100644
index 0000000..30bc71c
Binary files /dev/null and b/Bai11/Bai11/bin/BuildClass/VanBan.class differ
diff --git a/Bai11/Bai11/bin/UseClass/TestClass.class b/Bai11/Bai11/bin/UseClass/TestClass.class
new file mode 100644
index 0000000..dabf93c
Binary files /dev/null and b/Bai11/Bai11/bin/UseClass/TestClass.class differ
diff --git a/Bai11/Bai11/src/BuildClass/VanBan.java b/Bai11/Bai11/src/BuildClass/VanBan.java
new file mode 100644
index 0000000..5ee2184
--- /dev/null
+++ b/Bai11/Bai11/src/BuildClass/VanBan.java
@@ -0,0 +1,74 @@
+package BuildClass;
+
+public class VanBan {
+ // Thuoc tinh
+ private String noiDung;
+
+ // Phuong thuc
+ // Ham khoi tao khong doi so
+ public VanBan() {
+
+ }
+
+ // Ham khoi tao co doi so
+ public VanBan(String noiDung) {
+ this.noiDung = noiDung;
+ }
+
+ // Ham dem so tu trong 1 xau
+ public int countWordOfString(String xau) {
+ final char SPACE = ' ';
+ final char TAB = '\t';
+ final char BREAK_LINE = '\n';
+
+ if (xau == null) {
+ return -1;
+ }
+
+ int count = 0;
+ int n = xau.length();
+ boolean notCounted = true;
+
+ for (int i = 0; i < n; i++) {
+ if ((xau.charAt(i) != SPACE) && (xau.charAt(i) != TAB) && (xau.charAt(i) != BREAK_LINE)) {
+ if (notCounted) {
+ count++;
+ notCounted = false;
+
+ // Duyet tu dau den cuoi xau, trung nao chua het 1 tu thi van con duyet ky tu
+ // Khi het 1 tu thi tang count len 1 don vi
+ }
+ } else {
+ notCounted = true;
+ }
+ }
+
+ return count;
+ }
+
+ // Ham chuan hoa xau
+ public String chuanHoa(String xau) {
+ String xauOK = xau.trim(); // Loai bo ky tu trang o dau va cuoi xau
+
+ // Loai bo khoang o giua xau
+ while (xauOK.indexOf(" ") != -1) {
+ xauOK = xauOK.replaceAll(" ", " ");
+ }
+
+ return xau;
+ }
+
+ // Ham dem ky tu h
+ public int countH(String xau) {
+ int count = 0;
+
+ int n = xau.length();
+ for (int i = 0; i < n; i++) {
+ if ((xau.charAt(i) == 'h') || (xau.charAt(i) == 'H')) {
+ count++;
+ }
+ }
+
+ return count;
+ }
+}
diff --git a/Bai11/Bai11/src/UseClass/TestClass.java b/Bai11/Bai11/src/UseClass/TestClass.java
new file mode 100644
index 0000000..1b5a535
--- /dev/null
+++ b/Bai11/Bai11/src/UseClass/TestClass.java
@@ -0,0 +1,26 @@
+package UseClass;
+
+import java.util.Scanner;
+
+import BuildClass.VanBan;
+
+public class TestClass {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ System.out.print("Nhap vao xau ky tu: ");
+ String xau = sc.nextLine();
+
+ // Khai bao doi tuong
+ VanBan noiDung = new VanBan(xau);
+
+ System.out.println("Xau vua nhap la: " + xau);
+ System.out.println("Xau chuan hoa la: " + noiDung.chuanHoa(xau));
+ System.out.println("So tu cua xau la: " + noiDung.countWordOfString(xau));
+ System.out.println("So luong ky tu H la: " + noiDung.countH(xau));
+
+ sc.close();
+ }
+
+}
diff --git a/Bai12/Bai12/.classpath b/Bai12/Bai12/.classpath
new file mode 100644
index 0000000..4f2c72b
--- /dev/null
+++ b/Bai12/Bai12/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Bai12/Bai12/.project b/Bai12/Bai12/.project
new file mode 100644
index 0000000..86b69a4
--- /dev/null
+++ b/Bai12/Bai12/.project
@@ -0,0 +1,28 @@
+
+
+ Bai12
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272503
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai12/Bai12/.settings/org.eclipse.jdt.core.prefs b/Bai12/Bai12/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai12/Bai12/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai12/Bai12/bin/BuildClass/MaTran.class b/Bai12/Bai12/bin/BuildClass/MaTran.class
new file mode 100644
index 0000000..1cd5049
Binary files /dev/null and b/Bai12/Bai12/bin/BuildClass/MaTran.class differ
diff --git a/Bai12/Bai12/bin/UseClass/TestClass.class b/Bai12/Bai12/bin/UseClass/TestClass.class
new file mode 100644
index 0000000..621ccab
Binary files /dev/null and b/Bai12/Bai12/bin/UseClass/TestClass.class differ
diff --git a/Bai12/Bai12/src/BuildClass/MaTran.java b/Bai12/Bai12/src/BuildClass/MaTran.java
new file mode 100644
index 0000000..d1daf9f
--- /dev/null
+++ b/Bai12/Bai12/src/BuildClass/MaTran.java
@@ -0,0 +1,77 @@
+package BuildClass;
+
+import java.util.Scanner;
+
+public class MaTran {
+ // Thuoc tinh
+ private int soHang;
+ private int soCot;
+ private int[][] matran;
+
+ // Phuong thuc
+ // Ham khoi tao khong doi so
+ public MaTran() {
+ soHang = 0;
+ soCot = 0;
+ matran = new int[soHang][soCot];
+ }
+
+ // Ham khoi tao co doi so
+ public MaTran(int soHang, int soCot) {
+ this.soHang = soHang;
+ this.soCot = soCot;
+ matran = new int[soHang][soCot];
+ }
+
+ // Ham nhap vao ma tran
+ public void nhapMT(Scanner sc) {
+ for (int i = 0; i < soHang; i++) {
+ for (int j = 0; j < soCot; j++) {
+ System.out.print("Phan tu thu [" + (i + 1) + "][" + (j + 1) + "] = ");
+ matran[i][j] = sc.nextInt();
+ sc.nextLine();
+ }
+ }
+ }
+
+ // Ham hien thi ma tran
+ public void hienThiMT() {
+ for (int i = 0; i < soHang; i++) {
+ for (int j = 0; j < soCot; j++) {
+ System.out.print(matran[i][j] + "\t");
+ }
+
+ // Xuong dong
+ System.out.print("\n");
+ }
+ }
+
+ // Ham tinh tong 2 ma tran
+ public MaTran congMT(MaTran mt2) {
+ MaTran Tong = new MaTran(this.soHang, this.soCot);
+
+ for (int i = 0; i < soHang; i++) {
+ for (int j = 0; j < soCot; j++) {
+ Tong.matran[i][j] = this.matran[i][j] + mt2.matran[i][j];
+ }
+ }
+
+ return Tong;
+ }
+
+ // Ham nhan ma tran
+ public MaTran nhanMT(MaTran mt2) {
+ MaTran Tich = new MaTran(this.soHang, this.soCot);
+
+ for (int i = 0; i < soHang; i++) {
+ for (int j = 0; j < soCot; j++) {
+ Tich.matran[i][j] = 0;
+ for (int k = 0; k < soCot; k++) {
+ Tich.matran[i][j] += this.matran[i][k] * mt2.matran[k][j];
+ }
+ }
+ }
+
+ return Tich;
+ }
+}
diff --git a/Bai12/Bai12/src/UseClass/TestClass.java b/Bai12/Bai12/src/UseClass/TestClass.java
new file mode 100644
index 0000000..2196d15
--- /dev/null
+++ b/Bai12/Bai12/src/UseClass/TestClass.java
@@ -0,0 +1,45 @@
+package UseClass;
+
+import java.util.Scanner;
+
+import BuildClass.MaTran;
+
+public class TestClass {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ System.out.print("Nhap vao so hang: ");
+ int soHang = sc.nextInt();
+ sc.nextLine();
+ System.out.print("Nhap vao so cot: ");
+ int soCot = sc.nextInt();
+ sc.nextLine();
+
+ MaTran A = new MaTran(soHang, soCot);
+
+ System.out.println("Nhap vao thong tin cho ma tran A:");
+ A.nhapMT(sc);
+
+ MaTran B = new MaTran(soHang, soCot);
+
+ System.out.println("Nhap vao thong tin cho ma tran B:");
+ B.nhapMT(sc);
+
+ // Tinh tong
+ MaTran C = new MaTran(soHang, soCot);
+ C = A.congMT(B);
+
+ // Hien thi ma tran
+ System.out.println("Ma tran A la:");
+ A.hienThiMT();
+ System.out.print("\n");
+ System.out.println("Ma tran B la:");
+ B.hienThiMT();
+ System.out.println("Ma tran C la:");
+ C.hienThiMT();
+
+ sc.close();
+ }
+
+}
diff --git a/Bai13/Bai13/.classpath b/Bai13/Bai13/.classpath
new file mode 100644
index 0000000..4f2c72b
--- /dev/null
+++ b/Bai13/Bai13/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Bai13/Bai13/.project b/Bai13/Bai13/.project
new file mode 100644
index 0000000..a5b705b
--- /dev/null
+++ b/Bai13/Bai13/.project
@@ -0,0 +1,28 @@
+
+
+ Bai13
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272515
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai13/Bai13/.settings/org.eclipse.jdt.core.prefs b/Bai13/Bai13/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai13/Bai13/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai13/Bai13/bin/BuildClass/OTo.class b/Bai13/Bai13/bin/BuildClass/OTo.class
new file mode 100644
index 0000000..1780a46
Binary files /dev/null and b/Bai13/Bai13/bin/BuildClass/OTo.class differ
diff --git a/Bai13/Bai13/bin/BuildClass/PTGT.class b/Bai13/Bai13/bin/BuildClass/PTGT.class
new file mode 100644
index 0000000..732b7ba
Binary files /dev/null and b/Bai13/Bai13/bin/BuildClass/PTGT.class differ
diff --git a/Bai13/Bai13/bin/BuildClass/QLPTGT.class b/Bai13/Bai13/bin/BuildClass/QLPTGT.class
new file mode 100644
index 0000000..f25880b
Binary files /dev/null and b/Bai13/Bai13/bin/BuildClass/QLPTGT.class differ
diff --git a/Bai13/Bai13/bin/BuildClass/XeMay.class b/Bai13/Bai13/bin/BuildClass/XeMay.class
new file mode 100644
index 0000000..9f53d78
Binary files /dev/null and b/Bai13/Bai13/bin/BuildClass/XeMay.class differ
diff --git a/Bai13/Bai13/bin/BuildClass/XeTai.class b/Bai13/Bai13/bin/BuildClass/XeTai.class
new file mode 100644
index 0000000..4277a1b
Binary files /dev/null and b/Bai13/Bai13/bin/BuildClass/XeTai.class differ
diff --git a/Bai13/Bai13/bin/UseClass/TestClass.class b/Bai13/Bai13/bin/UseClass/TestClass.class
new file mode 100644
index 0000000..6ae877c
Binary files /dev/null and b/Bai13/Bai13/bin/UseClass/TestClass.class differ
diff --git a/Bai13/Bai13/src/BuildClass/OTo.java b/Bai13/Bai13/src/BuildClass/OTo.java
new file mode 100644
index 0000000..cd597e3
--- /dev/null
+++ b/Bai13/Bai13/src/BuildClass/OTo.java
@@ -0,0 +1,34 @@
+package BuildClass;
+
+import java.util.Scanner;
+
+public class OTo extends PTGT {
+ // Thuoc tinh
+ private int soCho;
+ private String kieuDongCo;
+
+ // Phuong thuc
+ public OTo() {
+
+ }
+
+ public OTo(int soCho, String kieuDongCo) {
+ this.soCho=soCho;
+ this.kieuDongCo=kieuDongCo;
+ }
+
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap so cho: ");
+ soCho=sc.nextInt();
+ System.out.print("\tNhap kieu dong co: ");
+ kieuDongCo=sc.nextLine();
+ }
+
+ // Ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tSo cho: "+soCho);
+ System.out.println("\tKieu dong co: "+kieuDongCo);
+ }
+}
diff --git a/Bai13/Bai13/src/BuildClass/PTGT.java b/Bai13/Bai13/src/BuildClass/PTGT.java
new file mode 100644
index 0000000..a99393d
--- /dev/null
+++ b/Bai13/Bai13/src/BuildClass/PTGT.java
@@ -0,0 +1,50 @@
+package BuildClass;
+
+import java.util.Scanner;
+
+public class PTGT {
+ // Thuoc tinh
+ protected String hangSX;
+ protected int namSX;
+ protected double gia;
+ protected String mau;
+
+ // Phuong thuc
+ // Ham khoi tao khong doi so
+ public PTGT() {
+
+ }
+
+ // Ham khoi tao co doi so
+ public PTGT(String hangSX, int namSX, double gia, String mau) {
+ this.hangSX=hangSX;
+ this.namSX=namSX;
+ this.gia=gia;
+ this.mau=mau;
+ }
+
+ // Ham nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap vao hang san xuat: ");
+ hangSX=sc.nextLine();
+ System.out.print("\tNhap vao nam san xuat: ");
+ namSX=sc.nextInt(); sc.nextLine();
+ System.out.print("\tNhap vao gia: ");
+ gia=sc.nextDouble(); sc.nextLine();
+ System.out.print("\tNhap vao mau sac: ");
+ mau=sc.nextLine();
+ }
+
+ // Ham hien thi thong tin
+ public void hienThiThongTin() {
+ System.out.println("\tHang san xuat: "+hangSX);
+ System.out.println("\tNam san xuat: "+namSX);
+ System.out.println("\tGia: "+gia);
+ System.out.println("\tMau: "+mau);
+ }
+
+ // Ham lay mau xe
+ public String getMau() {
+ return mau;
+ }
+}
diff --git a/Bai13/Bai13/src/BuildClass/QLPTGT.java b/Bai13/Bai13/src/BuildClass/QLPTGT.java
new file mode 100644
index 0000000..6c23621
--- /dev/null
+++ b/Bai13/Bai13/src/BuildClass/QLPTGT.java
@@ -0,0 +1,70 @@
+package BuildClass;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class QLPTGT {
+ // Thuoc tinh
+ private ArrayList ds;
+
+ // Phuong thuc
+ // Ham khoi tao
+ public QLPTGT() {
+ ds=new ArrayList(10);
+ }
+
+ // Ham them 1 pt vao ds
+ public void themPTGT(PTGT pt) {
+ ds.add(pt);
+ }
+
+ // Ham nhap vao danh sach
+ public void nhapDanhSach(Scanner sc) {
+ PTGT pt;
+ int chon;
+ System.out.print("Nhap vao so luong phuong tien: ");
+ int n=sc.nextInt(); sc.nextLine();
+
+ System.out.println("Nhap vao danh sach:");
+ for(int i=0;i
+
+
+
+
+
+
+
+
+
diff --git a/Bai14/Bai14/.project b/Bai14/Bai14/.project
new file mode 100644
index 0000000..779a42b
--- /dev/null
+++ b/Bai14/Bai14/.project
@@ -0,0 +1,28 @@
+
+
+ Bai14
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272524
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai14/Bai14/.settings/org.eclipse.jdt.core.prefs b/Bai14/Bai14/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai14/Bai14/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai14/Bai14/bin/BuildClass/DaGiac.class b/Bai14/Bai14/bin/BuildClass/DaGiac.class
new file mode 100644
index 0000000..a310e24
Binary files /dev/null and b/Bai14/Bai14/bin/BuildClass/DaGiac.class differ
diff --git a/Bai14/Bai14/bin/BuildClass/TamGiac.class b/Bai14/Bai14/bin/BuildClass/TamGiac.class
new file mode 100644
index 0000000..7237bac
Binary files /dev/null and b/Bai14/Bai14/bin/BuildClass/TamGiac.class differ
diff --git a/Bai14/Bai14/bin/UseClass/TestClass.class b/Bai14/Bai14/bin/UseClass/TestClass.class
new file mode 100644
index 0000000..48771d8
Binary files /dev/null and b/Bai14/Bai14/bin/UseClass/TestClass.class differ
diff --git a/Bai14/Bai14/src/BuildClass/DaGiac.java b/Bai14/Bai14/src/BuildClass/DaGiac.java
new file mode 100644
index 0000000..3885978
--- /dev/null
+++ b/Bai14/Bai14/src/BuildClass/DaGiac.java
@@ -0,0 +1,50 @@
+package BuildClass;
+
+import java.util.Scanner;
+
+public class DaGiac {
+ // Thuoc tinh
+ protected int soCanh;
+ protected int[] kichThuoc;
+
+ // Phuong thuc
+ // Ham khoi tao khong doi so
+ public DaGiac() {
+ soCanh=0;
+ kichThuoc=new int[soCanh];
+ }
+
+ // Ham khoi tao co doi so
+ public DaGiac(int soCanh) {
+ this.soCanh=soCanh;
+ kichThuoc=new int[soCanh];
+ }
+
+ // Ham nhap thong tin
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("Nhap vao so canh: ");
+ soCanh=sc.nextInt();
+ System.out.println("Nhap vao do dai cua cac canh:");
+ for(int i=0;ic) && (a+c>b) && (b+c>a)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ // Hien thi
+ public void display() {
+ System.out.println(kichThuoc[0]+", "+kichThuoc[1]+", "+kichThuoc[2]);
+ }
+}
diff --git a/Bai14/Bai14/src/UseClass/TestClass.java b/Bai14/Bai14/src/UseClass/TestClass.java
new file mode 100644
index 0000000..e590615
--- /dev/null
+++ b/Bai14/Bai14/src/UseClass/TestClass.java
@@ -0,0 +1,69 @@
+package UseClass;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+import BuildClass.TamGiac;
+
+public class TestClass {
+ // Thuoc tinh
+ private ArrayList ds;
+
+ // Phuong thuc
+ public TestClass() {
+ ds=new ArrayList(10);
+ }
+
+ // Them tg
+ public void themTG(TamGiac tg) {
+ ds.add(tg);
+ }
+
+ // Nhap danh sach
+ public void nhapDS(Scanner sc) {
+ TamGiac tg;
+ System.out.print("Nhap vao so luong tam giac: ");
+ int n=sc.nextInt();
+ for(int i=0;i
+
+
+
+
+
+
+
+
+
diff --git a/Bai15/Bai15/.project b/Bai15/Bai15/.project
new file mode 100644
index 0000000..539edf9
--- /dev/null
+++ b/Bai15/Bai15/.project
@@ -0,0 +1,28 @@
+
+
+ Bai15
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272534
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai15/Bai15/.settings/org.eclipse.jdt.core.prefs b/Bai15/Bai15/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai15/Bai15/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai15/Bai15/bin/BuildClass/Diem.class b/Bai15/Bai15/bin/BuildClass/Diem.class
new file mode 100644
index 0000000..4d31250
Binary files /dev/null and b/Bai15/Bai15/bin/BuildClass/Diem.class differ
diff --git a/Bai15/Bai15/bin/BuildClass/TamGiac.class b/Bai15/Bai15/bin/BuildClass/TamGiac.class
new file mode 100644
index 0000000..27c44bf
Binary files /dev/null and b/Bai15/Bai15/bin/BuildClass/TamGiac.class differ
diff --git a/Bai15/Bai15/bin/UseClass/TestClass.class b/Bai15/Bai15/bin/UseClass/TestClass.class
new file mode 100644
index 0000000..5b8b3e0
Binary files /dev/null and b/Bai15/Bai15/bin/UseClass/TestClass.class differ
diff --git a/Bai15/Bai15/src/BuildClass/Diem.java b/Bai15/Bai15/src/BuildClass/Diem.java
new file mode 100644
index 0000000..dd03242
--- /dev/null
+++ b/Bai15/Bai15/src/BuildClass/Diem.java
@@ -0,0 +1,50 @@
+package BuildClass;
+
+import java.lang.Math;
+
+public class Diem {
+ // Thuoc tinh
+ private double x;
+ private double y;
+
+ // Phuong thuc
+ // Ham khoi tao khong doi so
+ public Diem() {
+ x = 0;
+ y = 0;
+ }
+
+ // Ham khoi tao co doi so
+ public Diem(double x, double y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ // getter va setter cho x
+ public double getX() {
+ return x;
+ }
+
+ public void setX(double x) {
+ this.x = x;
+ }
+
+ // getter va setter cho y
+ public double getY() {
+ return y;
+ }
+
+ public void setY(double y) {
+ this.y = y;
+ }
+
+ // Ham hien thi diem
+ public void hienThiDiem() {
+ System.out.println("(" + x + "; " + y + ")");
+ }
+
+ // Ham tinh khoang cach giua 2 diem
+ public double tinhKC(Diem d2) {
+ return Math.sqrt((x - d2.x) * (x - d2.x) + (y - d2.y) * (y - d2.y));
+ }
+}
diff --git a/Bai15/Bai15/src/BuildClass/TamGiac.java b/Bai15/Bai15/src/BuildClass/TamGiac.java
new file mode 100644
index 0000000..f40d7bb
--- /dev/null
+++ b/Bai15/Bai15/src/BuildClass/TamGiac.java
@@ -0,0 +1,40 @@
+package BuildClass;
+
+public class TamGiac {
+ // Thuoc tinh
+ private Diem A;
+ private Diem B;
+ private Diem C;
+
+ // Phuong thuc
+ // Ham khoi tao
+ public TamGiac() {
+
+ }
+
+ public TamGiac(Diem d1, Diem d2, Diem d3) {
+ A=d1;
+ B=d2;
+ C=d3;
+ }
+
+ // Ham tinh chu vi hinh tam giac
+ public double tinhCV() {
+ double AB=A.tinhKC(B);
+ double AC=A.tinhKC(C);
+ double BC=B.tinhKC(C);
+
+ return (AB+AC+BC);
+ }
+
+ // Ham tinh dien tich
+ public double tinhDT() {
+ double AB=A.tinhKC(B);
+ double AC=A.tinhKC(C);
+ double BC=B.tinhKC(C);
+
+ double p=(AB+AC+BC)/2;
+
+ return Math.sqrt(p*(p-AB)*(p-AC)*(p-BC));
+ }
+}
diff --git a/Bai15/Bai15/src/UseClass/TestClass.java b/Bai15/Bai15/src/UseClass/TestClass.java
new file mode 100644
index 0000000..d2540ea
--- /dev/null
+++ b/Bai15/Bai15/src/UseClass/TestClass.java
@@ -0,0 +1,23 @@
+package UseClass;
+
+import java.text.DecimalFormat;
+
+import BuildClass.Diem;
+import BuildClass.TamGiac;
+
+public class TestClass {
+
+ public static void main(String[] args) {
+ DecimalFormat df = new DecimalFormat(".##");
+
+ // Khai bao doi tuong
+ Diem A = new Diem(0, 0);
+ Diem B = new Diem(2, 1);
+ Diem C = new Diem(-4, 5);
+ TamGiac tg = new TamGiac(A, B, C);
+
+ System.out.println("Chu vi hinh tam giac la: " + df.format(tg.tinhCV()));
+ System.out.println("Dien tich hinh tam giac la: " + df.format(tg.tinhDT()));
+ }
+
+}
diff --git a/Bai16/Bai16/.classpath b/Bai16/Bai16/.classpath
new file mode 100644
index 0000000..4f2c72b
--- /dev/null
+++ b/Bai16/Bai16/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Bai16/Bai16/.project b/Bai16/Bai16/.project
new file mode 100644
index 0000000..821fc3f
--- /dev/null
+++ b/Bai16/Bai16/.project
@@ -0,0 +1,28 @@
+
+
+ Bai16
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272546
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai16/Bai16/.settings/org.eclipse.jdt.core.prefs b/Bai16/Bai16/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai16/Bai16/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai16/Bai16/bin/BuildClass/Diem.class b/Bai16/Bai16/bin/BuildClass/Diem.class
new file mode 100644
index 0000000..65dc118
Binary files /dev/null and b/Bai16/Bai16/bin/BuildClass/Diem.class differ
diff --git a/Bai16/Bai16/bin/BuildClass/HinhTron.class b/Bai16/Bai16/bin/BuildClass/HinhTron.class
new file mode 100644
index 0000000..b49de6e
Binary files /dev/null and b/Bai16/Bai16/bin/BuildClass/HinhTron.class differ
diff --git a/Bai16/Bai16/bin/UseClass/Test.class b/Bai16/Bai16/bin/UseClass/Test.class
new file mode 100644
index 0000000..1d77946
Binary files /dev/null and b/Bai16/Bai16/bin/UseClass/Test.class differ
diff --git a/Bai16/Bai16/src/BuildClass/Diem.java b/Bai16/Bai16/src/BuildClass/Diem.java
new file mode 100644
index 0000000..c224a65
--- /dev/null
+++ b/Bai16/Bai16/src/BuildClass/Diem.java
@@ -0,0 +1,46 @@
+package BuildClass;
+
+import java.lang.Math;
+
+public class Diem {
+ // Thuoc tinh
+ private double x;
+ private double y;
+
+ // Phuong thuc
+ public Diem() {
+ this.x = 0;
+ this.y = 0;
+ }
+
+ public Diem(double x, double y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public double getX() {
+ return x;
+ }
+
+ public void setX(double x) {
+ this.x = x;
+ }
+
+ public double getY() {
+ return y;
+ }
+
+ public void setY(double y) {
+ this.y = y;
+ }
+
+ // Hien thi thong tin cua diem
+ public void hienThiDiem() {
+ System.out.println("(" + x + "; " + y + ")");
+ }
+
+ // Tinh khoang cach giua 2 diem
+ public double tinhKC(Diem d2) {
+ return Math.sqrt((x - d2.x) * (x - d2.x) + (y - d2.y) * (y - d2.y));
+ }
+}
diff --git a/Bai16/Bai16/src/BuildClass/HinhTron.java b/Bai16/Bai16/src/BuildClass/HinhTron.java
new file mode 100644
index 0000000..9ce4ee9
--- /dev/null
+++ b/Bai16/Bai16/src/BuildClass/HinhTron.java
@@ -0,0 +1,28 @@
+package BuildClass;
+
+public class HinhTron {
+ // Thuoc tinh
+ private Diem tam;
+ private int bk;
+
+ // Phuong thuc
+ public HinhTron() {
+ tam = new Diem(0, 0);
+ bk = 0;
+ }
+
+ public HinhTron(Diem tam, int bk) {
+ this.tam = tam;
+ this.bk = bk;
+ }
+
+ // Tinh Chu vi
+ public double tinhCV() {
+ return 2 * Math.PI * bk;
+ }
+
+ // Tinh Dien tich
+ public double tinhDT() {
+ return Math.PI * bk * bk;
+ }
+}
diff --git a/Bai16/Bai16/src/UseClass/Test.java b/Bai16/Bai16/src/UseClass/Test.java
new file mode 100644
index 0000000..fa722f7
--- /dev/null
+++ b/Bai16/Bai16/src/UseClass/Test.java
@@ -0,0 +1,22 @@
+package UseClass;
+
+import java.text.DecimalFormat;
+
+import BuildClass.Diem;
+import BuildClass.HinhTron;
+
+public class Test {
+
+ public static void main(String[] args) {
+ DecimalFormat df=new DecimalFormat(".##");
+
+ Diem I=new Diem(1, 2);
+ int r=10;
+
+ HinhTron O=new HinhTron(I, r);
+
+ System.out.println("Chu vi hinh tron la: "+df.format(O.tinhCV()));
+ System.out.println("Dien tich hinh tron la: "+df.format(O.tinhDT()));
+ }
+
+}
diff --git a/Bai2/Bai2/.classpath b/Bai2/Bai2/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai2/Bai2/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai2/Bai2/.project b/Bai2/Bai2/.project
new file mode 100644
index 0000000..08f6d3c
--- /dev/null
+++ b/Bai2/Bai2/.project
@@ -0,0 +1,28 @@
+
+
+ Bai2
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272553
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai2/Bai2/.settings/org.eclipse.jdt.core.prefs b/Bai2/Bai2/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai2/Bai2/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai2/Bai2/bin/Class/CanBo.class b/Bai2/Bai2/bin/Class/CanBo.class
new file mode 100644
index 0000000..80152b8
Binary files /dev/null and b/Bai2/Bai2/bin/Class/CanBo.class differ
diff --git a/Bai2/Bai2/bin/Class/CongNhan.class b/Bai2/Bai2/bin/Class/CongNhan.class
new file mode 100644
index 0000000..0ab31d1
Binary files /dev/null and b/Bai2/Bai2/bin/Class/CongNhan.class differ
diff --git a/Bai2/Bai2/bin/Class/KySu.class b/Bai2/Bai2/bin/Class/KySu.class
new file mode 100644
index 0000000..e32d650
Binary files /dev/null and b/Bai2/Bai2/bin/Class/KySu.class differ
diff --git a/Bai2/Bai2/bin/Class/NhanVien.class b/Bai2/Bai2/bin/Class/NhanVien.class
new file mode 100644
index 0000000..b73ba0a
Binary files /dev/null and b/Bai2/Bai2/bin/Class/NhanVien.class differ
diff --git a/Bai2/Bai2/bin/Class/QLCB.class b/Bai2/Bai2/bin/Class/QLCB.class
new file mode 100644
index 0000000..859b711
Binary files /dev/null and b/Bai2/Bai2/bin/Class/QLCB.class differ
diff --git a/Bai2/Bai2/bin/Testing/Test.class b/Bai2/Bai2/bin/Testing/Test.class
new file mode 100644
index 0000000..ad1fb41
Binary files /dev/null and b/Bai2/Bai2/bin/Testing/Test.class differ
diff --git a/Bai2/Bai2/src/Class/CanBo.java b/Bai2/Bai2/src/Class/CanBo.java
new file mode 100644
index 0000000..9bf9f1c
--- /dev/null
+++ b/Bai2/Bai2/src/Class/CanBo.java
@@ -0,0 +1,50 @@
+package Class;
+
+import java.util.Scanner;
+
+public class CanBo {
+ // thuoc tinh
+ private String hoTen;
+ private String ngaySinh;
+ private String gioiTinh;
+ private String diaChi;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public CanBo() {
+
+ }
+
+ // ham khoi tao co doi so
+ public CanBo(String hoten, String ngaySinh, String gioiTinh, String diaChi) {
+ this.hoTen = hoten;
+ this.ngaySinh = ngaySinh;
+ this.gioiTinh = gioiTinh;
+ this.diaChi = diaChi;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ho ten: ");
+ hoTen = sc.nextLine();
+ System.out.print("\tNhap ngay sinh (dd/MM/yyyy): ");
+ ngaySinh = sc.nextLine();
+ System.out.print("\tNhap gioi tinh: ");
+ gioiTinh = sc.nextLine();
+ System.out.print("\tNhap dia chi: ");
+ diaChi = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tHo ten: " + hoTen);
+ System.out.println("\tNgay sinh: " + ngaySinh);
+ System.out.println("\tGioi tinh: " + gioiTinh);
+ System.out.println("\tDia chi: " + diaChi);
+ }
+
+ // ham lay thong tin ho ten
+ public String getHoTen() {
+ return this.hoTen;
+ }
+}
diff --git a/Bai2/Bai2/src/Class/CongNhan.java b/Bai2/Bai2/src/Class/CongNhan.java
new file mode 100644
index 0000000..cf97deb
--- /dev/null
+++ b/Bai2/Bai2/src/Class/CongNhan.java
@@ -0,0 +1,33 @@
+package Class;
+
+import java.util.Scanner;
+
+public class CongNhan extends CanBo {
+ // thuoc tinh
+ private String bac;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public CongNhan() {
+
+ }
+
+ // ham khoi tao co doi so
+ public CongNhan(String hoten, String ngaySinh, String gioiTinh, String diaChi, String bac) {
+ super(hoten, ngaySinh, gioiTinh, diaChi);
+ this.bac = bac;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap bac: ");
+ bac = sc.nextLine();
+ }
+
+ // ham hien thi thong tin
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tBac: " + bac);
+ }
+}
diff --git a/Bai2/Bai2/src/Class/KySu.java b/Bai2/Bai2/src/Class/KySu.java
new file mode 100644
index 0000000..1831b4a
--- /dev/null
+++ b/Bai2/Bai2/src/Class/KySu.java
@@ -0,0 +1,33 @@
+package Class;
+
+import java.util.Scanner;
+
+public class KySu extends CanBo {
+ // thuoc tinh
+ private String nganhDaoTao;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public KySu() {
+
+ }
+
+ // ham khoi tao co doi so
+ public KySu(String hoten, String ngaySinh, String gioiTinh, String diaChi, String nganhDaoTao) {
+ super(hoten, ngaySinh, gioiTinh, diaChi);
+ this.nganhDaoTao = nganhDaoTao;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap nganh dao tao: ");
+ nganhDaoTao = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tNganh dao tao: " + nganhDaoTao);
+ }
+}
diff --git a/Bai2/Bai2/src/Class/NhanVien.java b/Bai2/Bai2/src/Class/NhanVien.java
new file mode 100644
index 0000000..1ea85dc
--- /dev/null
+++ b/Bai2/Bai2/src/Class/NhanVien.java
@@ -0,0 +1,33 @@
+package Class;
+
+import java.util.Scanner;
+
+public class NhanVien extends CanBo {
+ // thuoc tinh
+ private String congViec;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public NhanVien() {
+
+ }
+
+ // ham khoi tao co doi so
+ public NhanVien(String hoten, String ngaySinh, String gioiTinh, String diaChi, String congViec) {
+ super(hoten, ngaySinh, gioiTinh, diaChi);
+ this.congViec = congViec;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap cong viec: ");
+ congViec = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tCong viec: " + congViec);
+ }
+}
diff --git a/Bai2/Bai2/src/Class/QLCB.java b/Bai2/Bai2/src/Class/QLCB.java
new file mode 100644
index 0000000..cf3fbb4
--- /dev/null
+++ b/Bai2/Bai2/src/Class/QLCB.java
@@ -0,0 +1,69 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class QLCB {
+ // thuoc tinh
+ private ArrayList dscb;
+
+ // phuong thuc
+ // ham khoi tao
+ public QLCB() {
+ dscb = new ArrayList(10);
+ }
+
+ // ham them can bo
+ public void themCanBo(CanBo cb) {
+ dscb.add(cb);
+ }
+
+ // ham nhap danh sach
+ public void nhapDanhSach(Scanner sc) {
+ CanBo cb;
+ System.out.print("Nhap vao so luong can bo: ");
+ int n = sc.nextInt();
+ sc.nextLine();
+
+ System.out.println("Nhap thong tin chi tiet:");
+ for (int i = 0; i < n; i++) {
+ System.out.println("Lan nhap thu " + (i + 1) + ":");
+ System.out.print("Chon can bo (1-KySu; 2-NhanVien;3-CongNhan): ");
+ int chon = sc.nextInt();
+ sc.nextLine();
+
+ cb = new CanBo();
+
+ switch (chon) {
+ case 1:
+ cb = new KySu();
+ break;
+ case 2:
+ cb = new NhanVien();
+ break;
+ case 3:
+ cb = new CongNhan();
+ break;
+
+ default:
+ cb = new KySu();
+ break;
+ }
+
+ // sau khi chon loai can bo thi nhap thong tin cho can bo do
+ cb.nhapThongTin(sc);
+
+ // nhap xong roi thi them can bo vao danh sach
+ themCanBo(cb);
+ }
+ }
+
+ // ham tim kiem theo ten
+ public void timKiemCanBo(String hoTen) {
+ for (CanBo cb : dscb) {
+ if (hoTen.equals(cb.getHoTen())) {
+ cb.hienThiThongTin();
+ }
+ }
+ }
+}
diff --git a/Bai2/Bai2/src/Testing/Test.java b/Bai2/Bai2/src/Testing/Test.java
new file mode 100644
index 0000000..2d16a6a
--- /dev/null
+++ b/Bai2/Bai2/src/Testing/Test.java
@@ -0,0 +1,25 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.QLCB;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ QLCB qlcb = new QLCB();
+
+ qlcb.nhapDanhSach(sc);
+
+ System.out.print("Nhap vao ho ten can tim kiem: ");
+ String name = sc.nextLine();
+
+ qlcb.timKiemCanBo(name);
+
+ // huy sc
+ sc.close();
+ }
+
+}
diff --git a/Bai3/Bai3/.classpath b/Bai3/Bai3/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai3/Bai3/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai3/Bai3/.project b/Bai3/Bai3/.project
new file mode 100644
index 0000000..93fd09e
--- /dev/null
+++ b/Bai3/Bai3/.project
@@ -0,0 +1,28 @@
+
+
+ Bai3
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272563
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai3/Bai3/.settings/org.eclipse.jdt.core.prefs b/Bai3/Bai3/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai3/Bai3/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai3/Bai3/bin/Class/Bao.class b/Bai3/Bai3/bin/Class/Bao.class
new file mode 100644
index 0000000..7af85b7
Binary files /dev/null and b/Bai3/Bai3/bin/Class/Bao.class differ
diff --git a/Bai3/Bai3/bin/Class/QuanLySach.class b/Bai3/Bai3/bin/Class/QuanLySach.class
new file mode 100644
index 0000000..8ffe30a
Binary files /dev/null and b/Bai3/Bai3/bin/Class/QuanLySach.class differ
diff --git a/Bai3/Bai3/bin/Class/Sach.class b/Bai3/Bai3/bin/Class/Sach.class
new file mode 100644
index 0000000..aa28cbb
Binary files /dev/null and b/Bai3/Bai3/bin/Class/Sach.class differ
diff --git a/Bai3/Bai3/bin/Class/TaiLieu.class b/Bai3/Bai3/bin/Class/TaiLieu.class
new file mode 100644
index 0000000..173c07b
Binary files /dev/null and b/Bai3/Bai3/bin/Class/TaiLieu.class differ
diff --git a/Bai3/Bai3/bin/Class/TapChi.class b/Bai3/Bai3/bin/Class/TapChi.class
new file mode 100644
index 0000000..e223e7c
Binary files /dev/null and b/Bai3/Bai3/bin/Class/TapChi.class differ
diff --git a/Bai3/Bai3/bin/Testing/Test.class b/Bai3/Bai3/bin/Testing/Test.class
new file mode 100644
index 0000000..c37c183
Binary files /dev/null and b/Bai3/Bai3/bin/Testing/Test.class differ
diff --git a/Bai3/Bai3/src/Class/Bao.java b/Bai3/Bai3/src/Class/Bao.java
new file mode 100644
index 0000000..5da5969
--- /dev/null
+++ b/Bai3/Bai3/src/Class/Bao.java
@@ -0,0 +1,33 @@
+package Class;
+
+import java.util.Scanner;
+
+public class Bao extends TaiLieu {
+ // thuoc tinh
+ private String ngayPhatHanh;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public Bao() {
+
+ }
+
+ // ham khoi tao co doi so
+ public Bao(String maTaiLieu, String tenNXB, int soBanPhatHanh, String ngayPhatHanh) {
+ super(maTaiLieu, tenNXB, soBanPhatHanh);
+ this.ngayPhatHanh = ngayPhatHanh;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap ngay phat hanh: ");
+ ngayPhatHanh = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tNgay phat hanh: " + ngayPhatHanh);
+ }
+}
diff --git a/Bai3/Bai3/src/Class/QuanLySach.java b/Bai3/Bai3/src/Class/QuanLySach.java
new file mode 100644
index 0000000..51863a5
--- /dev/null
+++ b/Bai3/Bai3/src/Class/QuanLySach.java
@@ -0,0 +1,82 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class QuanLySach {
+ // thuoc tinh
+ private ArrayList dstl;
+
+ // phuong thuc
+ // ham khoi tao
+ public QuanLySach() {
+ dstl = new ArrayList(10);
+ }
+
+ // them moi 1 tai lieu
+ public void themTaiLieu(TaiLieu tl) {
+ dstl.add(tl);
+ }
+
+ public void inDanhSachTL() {
+ for (TaiLieu taiLieu : dstl) {
+ System.out.println(taiLieu);
+ }
+ }
+ // nhap danh sach tai lieu
+ public void nhapDanhSachTL(Scanner sc) {
+ int chon;
+ String stop;
+ TaiLieu tl;
+
+ do {
+ System.out.print("Chon loai tai lieu (1-Sach; 2-TapChi; 3-Bao): ");
+ chon = sc.nextInt();
+ sc.nextLine();
+
+ switch (chon) {
+ case 1:
+ tl = new Sach();
+ break;
+ case 2:
+ tl = new TapChi();
+ break;
+ case 3:
+ tl = new Bao();
+ break;
+
+ default:
+ tl = new Sach();
+ break;
+ }
+
+ tl.nhapThongTin(sc);
+ inDanhSachTL();
+ themTaiLieu(tl);
+ System.out.print("\nBan co muon nhap vao nua hay khong (c/k): ");
+ stop = sc.nextLine();
+ } while (stop.equals("c"));
+ }
+
+ // tim kiem theo ma tai lieu
+ public void timMaTL(String maTL) {
+ for (TaiLieu tl : dstl) {
+ if (maTL.equals(tl.getMaTaiLieu())) {
+ tl.hienThiThongTin();
+ }
+ }
+ }
+
+ // tim kiem theo loai tai lieu
+ public void timLoaiTL(String loai) {
+ for (TaiLieu tl : dstl) {
+ if (loai.equals("Sach") && (tl instanceof Sach)) {
+ tl.hienThiThongTin();
+ } else if (loai.equals("TapChi") && (tl instanceof TapChi)) {
+ tl.hienThiThongTin();
+ } else if (loai.equals("Bao") && (tl instanceof Bao)) {
+ tl.hienThiThongTin();
+ }
+ }
+ }
+}
diff --git a/Bai3/Bai3/src/Class/Sach.java b/Bai3/Bai3/src/Class/Sach.java
new file mode 100644
index 0000000..3756f0a
--- /dev/null
+++ b/Bai3/Bai3/src/Class/Sach.java
@@ -0,0 +1,39 @@
+package Class;
+
+import java.util.Scanner;
+
+public class Sach extends TaiLieu {
+ // thuoc tinh
+ private String tacGia;
+ private int soTrang;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public Sach() {
+
+ }
+
+ // ham khoi tao co doi so
+ public Sach(String maTaiLieu, String tenNXB, int soBanPhatHanh, String tacGia, int soTrang) {
+ super(maTaiLieu, tenNXB, soBanPhatHanh);
+ this.tacGia = tacGia;
+ this.soTrang = soTrang;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap tac gia: ");
+ tacGia = sc.nextLine();
+ System.out.print("\tNhap so trang: ");
+ soTrang = sc.nextInt();
+ sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\ttac gia: " + tacGia);
+ System.out.println("\tSo trang: " + soTrang);
+ }
+}
diff --git a/Bai3/Bai3/src/Class/TaiLieu.java b/Bai3/Bai3/src/Class/TaiLieu.java
new file mode 100644
index 0000000..032f499
--- /dev/null
+++ b/Bai3/Bai3/src/Class/TaiLieu.java
@@ -0,0 +1,46 @@
+package Class;
+
+import java.util.Scanner;
+
+public class TaiLieu {
+ // thuoc tinh
+ private String maTaiLieu;
+ private String tenNXB;
+ private int soBanPhatHanh;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public TaiLieu() {
+
+ }
+
+ // ham khoi tao co doi so
+ public TaiLieu(String maTaiLieu, String tenNXB, int soBanPhatHanh) {
+ this.maTaiLieu = maTaiLieu;
+ this.tenNXB = tenNXB;
+ this.soBanPhatHanh = soBanPhatHanh;
+ }
+
+ // nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ma tai lieu: ");
+ maTaiLieu = sc.nextLine();
+ System.out.print("\tNhap ten nha xuat ban: ");
+ tenNXB = sc.nextLine();
+ System.out.print("\tNhap so ban phat hanh: ");
+ soBanPhatHanh = sc.nextInt();
+ sc.nextLine();
+ }
+
+ // hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tMa tai lieu: " + maTaiLieu);
+ System.out.println("\tTen nha xuat ban: " + tenNXB);
+ System.out.println("\tSo ban phat hanh: " + soBanPhatHanh);
+ }
+
+ // ham lay ra ma tai lieu
+ public String getMaTaiLieu() {
+ return maTaiLieu;
+ }
+}
diff --git a/Bai3/Bai3/src/Class/TapChi.java b/Bai3/Bai3/src/Class/TapChi.java
new file mode 100644
index 0000000..2730c54
--- /dev/null
+++ b/Bai3/Bai3/src/Class/TapChi.java
@@ -0,0 +1,39 @@
+package Class;
+
+import java.util.Scanner;
+
+public class TapChi extends TaiLieu {
+ // thuoc tinh
+ private int soPhatHanh;
+ private int thangPhatHanh;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public TapChi() {
+
+ }
+
+ // ham khoi tao co doi so
+ public TapChi(String maTaiLieu, String tenNXB, int soBanPhatHanh, int soPhatHanh, int thangPhatHanh) {
+ super(maTaiLieu, tenNXB, soBanPhatHanh);
+ this.soPhatHanh = soBanPhatHanh;
+ this.thangPhatHanh = thangPhatHanh;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap so phat hanh: ");
+ soPhatHanh = sc.nextInt();
+ System.out.print("\tNhap thang phat hanh: ");
+ thangPhatHanh = sc.nextInt();
+ sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tSo phat hanh: " + soPhatHanh);
+ System.out.println("\tThang phat hanh: " + thangPhatHanh);
+ }
+}
diff --git a/Bai3/Bai3/src/Testing/Test.java b/Bai3/Bai3/src/Testing/Test.java
new file mode 100644
index 0000000..18e6628
--- /dev/null
+++ b/Bai3/Bai3/src/Testing/Test.java
@@ -0,0 +1,27 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.QuanLySach;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ QuanLySach qls = new QuanLySach();
+
+ qls.nhapDanhSachTL(sc);
+ qls.inDanhSachTL();
+ System.out.print("\n\nNhap vao loai tai lieu can tim: ");
+ String loai = sc.nextLine();
+ qls.timLoaiTL(loai);
+
+ System.out.print("\n\nNhap vao ma tai lieu can tim: ");
+ String maTL = sc.nextLine();
+ qls.timMaTL(maTL);
+
+ sc.close();
+ }
+
+}
diff --git a/Bai4/Bai4/.classpath b/Bai4/Bai4/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai4/Bai4/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai4/Bai4/.project b/Bai4/Bai4/.project
new file mode 100644
index 0000000..13c1756
--- /dev/null
+++ b/Bai4/Bai4/.project
@@ -0,0 +1,28 @@
+
+
+ Bai4
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272574
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai4/Bai4/.settings/org.eclipse.jdt.core.prefs b/Bai4/Bai4/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai4/Bai4/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai4/Bai4/bin/Class/KhoiA.class b/Bai4/Bai4/bin/Class/KhoiA.class
new file mode 100644
index 0000000..70a793d
Binary files /dev/null and b/Bai4/Bai4/bin/Class/KhoiA.class differ
diff --git a/Bai4/Bai4/bin/Class/KhoiB.class b/Bai4/Bai4/bin/Class/KhoiB.class
new file mode 100644
index 0000000..3ceb9cf
Binary files /dev/null and b/Bai4/Bai4/bin/Class/KhoiB.class differ
diff --git a/Bai4/Bai4/bin/Class/KhoiC.class b/Bai4/Bai4/bin/Class/KhoiC.class
new file mode 100644
index 0000000..5805b83
Binary files /dev/null and b/Bai4/Bai4/bin/Class/KhoiC.class differ
diff --git a/Bai4/Bai4/bin/Class/ThiSinh.class b/Bai4/Bai4/bin/Class/ThiSinh.class
new file mode 100644
index 0000000..3c9a17a
Binary files /dev/null and b/Bai4/Bai4/bin/Class/ThiSinh.class differ
diff --git a/Bai4/Bai4/bin/Class/TuyenSinh.class b/Bai4/Bai4/bin/Class/TuyenSinh.class
new file mode 100644
index 0000000..d507ab2
Binary files /dev/null and b/Bai4/Bai4/bin/Class/TuyenSinh.class differ
diff --git a/Bai4/Bai4/bin/Testing/Test.class b/Bai4/Bai4/bin/Testing/Test.class
new file mode 100644
index 0000000..84c14ac
Binary files /dev/null and b/Bai4/Bai4/bin/Testing/Test.class differ
diff --git a/Bai4/Bai4/src/Class/KhoiA.java b/Bai4/Bai4/src/Class/KhoiA.java
new file mode 100644
index 0000000..a5e9a3e
--- /dev/null
+++ b/Bai4/Bai4/src/Class/KhoiA.java
@@ -0,0 +1,40 @@
+package Class;
+
+import java.util.Scanner;
+
+public class KhoiA extends ThiSinh {
+ // thuoc tinh
+ private String mon1;
+ private String mon2;
+ private String mon3;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public KhoiA() {
+
+ }
+
+ // ham khoi tao co doi so
+ public KhoiA(String mon1, String mon2, String mon3) {
+ this.mon1 = mon1;
+ this.mon2 = mon2;
+ this.mon3 = mon3;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+ System.out.print("\tNhap mon 1: ");
+ mon1 = sc.nextLine();
+ System.out.print("\tNhap mon 2: ");
+ mon2 = sc.nextLine();
+ System.out.print("\tNhap mon 3: ");
+ mon3 = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+ System.out.println("\tTo hop mon thi: " + mon1 + " - " + mon2 + " - " + mon3);
+ }
+}
diff --git a/Bai4/Bai4/src/Class/KhoiB.java b/Bai4/Bai4/src/Class/KhoiB.java
new file mode 100644
index 0000000..d470247
--- /dev/null
+++ b/Bai4/Bai4/src/Class/KhoiB.java
@@ -0,0 +1,15 @@
+package Class;
+
+public class KhoiB extends KhoiA {
+ // thuoc tinh
+
+ // phuong thuc
+ // ham khoi tao
+ public KhoiB() {
+
+ }
+
+ public KhoiB(String mon1, String mon2, String mon3) {
+ super(mon1, mon2, mon3);
+ }
+}
diff --git a/Bai4/Bai4/src/Class/KhoiC.java b/Bai4/Bai4/src/Class/KhoiC.java
new file mode 100644
index 0000000..79628f6
--- /dev/null
+++ b/Bai4/Bai4/src/Class/KhoiC.java
@@ -0,0 +1,15 @@
+package Class;
+
+public class KhoiC extends KhoiA {
+ // thuoc tinh
+
+ // phuong thuc
+ // ham khoi tao
+ public KhoiC() {
+
+ }
+
+ public KhoiC(String mon1, String mon2, String mon3) {
+ super(mon1, mon2, mon3);
+ }
+}
diff --git a/Bai4/Bai4/src/Class/ThiSinh.java b/Bai4/Bai4/src/Class/ThiSinh.java
new file mode 100644
index 0000000..ae4ab09
--- /dev/null
+++ b/Bai4/Bai4/src/Class/ThiSinh.java
@@ -0,0 +1,51 @@
+package Class;
+
+import java.util.Scanner;
+
+public class ThiSinh {
+ // thuoc tinh
+ private int soBD;
+ private String hoTen;
+ private String diaChi;
+ private String dienUuTien;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public ThiSinh() {
+
+ }
+
+ // ham khoi tao co doi so
+ public ThiSinh(int soBD, String hoTen, String diaChi, String dienUuTien) {
+ this.soBD = soBD;
+ this.hoTen = hoTen;
+ this.diaChi = diaChi;
+ this.dienUuTien = dienUuTien;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap so bao danh: ");
+ soBD = sc.nextInt();
+ sc.nextLine();
+ System.out.print("\tNhap ho ten: ");
+ hoTen = sc.nextLine();
+ System.out.print("\tNhap dia chi: ");
+ diaChi = sc.nextLine();
+ System.out.print("\tNhap dien uu tien: ");
+ dienUuTien = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tSo bao danh: " + soBD);
+ System.out.println("\tHo ten: " + hoTen);
+ System.out.println("\tDia chi: " + diaChi);
+ System.out.println("\tDien uu tien: " + dienUuTien);
+ }
+
+ // ham lay ra thong tin ve so bao danh
+ public int getSoBD() {
+ return soBD;
+ }
+}
diff --git a/Bai4/Bai4/src/Class/TuyenSinh.java b/Bai4/Bai4/src/Class/TuyenSinh.java
new file mode 100644
index 0000000..24c723b
--- /dev/null
+++ b/Bai4/Bai4/src/Class/TuyenSinh.java
@@ -0,0 +1,70 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class TuyenSinh {
+ // thuoc tinh
+ private ArrayList dsts;
+
+ // phuong thuc
+ public TuyenSinh() {
+ dsts = new ArrayList(10);
+ }
+
+ // ham them 1 thi sinh
+ public void themThiSinh(ThiSinh ts) {
+ dsts.add(ts);
+ }
+
+ // nhap danh sach
+ public void nhapDanhSach(Scanner sc) {
+ ThiSinh ts;
+ int chon;
+
+ System.out.print("Nhap vao so luong thi sinh: ");
+ int n = sc.nextInt();
+ sc.nextLine();
+
+ for (int i = 0; i < n; i++) {
+ System.out.println("Thi sinh thuoc khoi nao (1-KhoiA; 2-KhoiB; 3-KhoiC): ");
+ chon = sc.nextInt();
+
+ switch (chon) {
+ case 1:
+ ts = new KhoiA("Toan", "Ly", "Hoa");
+ break;
+ case 2:
+ ts = new KhoiB("Toan", "Hoa", "Sinh");
+ break;
+ case 3:
+ ts = new KhoiC("Van", "Su", "Dia");
+ break;
+ default:
+ ts = new KhoiA("Toan", "Ly", "Hoa");
+ break;
+ }
+
+ ts.nhapThongTin(sc);
+ themThiSinh(ts);
+ }
+ }
+
+ // ham hien thi
+ public void hienThiDanhSach() {
+ int n = dsts.size();
+ for (int i = 0; i < n; i++) {
+ System.out.println("Thi sinh thu " + (i + 1) + " la:");
+ dsts.get(i).hienThiThongTin();
+ }
+ }
+
+ // tim kiem thi sinh theo so bao danh
+ public void timKiemThiSinh(int soBaoDanh) {
+ for (ThiSinh ts : dsts) {
+ if (ts.getSoBD() == soBaoDanh) {
+ ts.hienThiThongTin();
+ }
+ }
+ }
+}
diff --git a/Bai4/Bai4/src/Testing/Test.java b/Bai4/Bai4/src/Testing/Test.java
new file mode 100644
index 0000000..c9f740d
--- /dev/null
+++ b/Bai4/Bai4/src/Testing/Test.java
@@ -0,0 +1,29 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.TuyenSinh;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ TuyenSinh dsTuyenSinh = new TuyenSinh();
+
+ System.out.println("Nhap vao danh sach thi sinh: ");
+ dsTuyenSinh.nhapDanhSach(sc);
+
+ System.out.println("Danh sach thi sinh du thi la:");
+ dsTuyenSinh.hienThiDanhSach();
+
+ System.out.print("Nhap so bao danh can tim: ");
+ int soBaoDanh = sc.nextInt();
+ sc.nextLine();
+
+ dsTuyenSinh.timKiemThiSinh(soBaoDanh);
+
+ sc.close();
+ }
+
+}
diff --git a/Bai5/Bai5/.classpath b/Bai5/Bai5/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai5/Bai5/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai5/Bai5/.project b/Bai5/Bai5/.project
new file mode 100644
index 0000000..d344083
--- /dev/null
+++ b/Bai5/Bai5/.project
@@ -0,0 +1,28 @@
+
+
+ Bai5
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272586
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai5/Bai5/.settings/org.eclipse.jdt.core.prefs b/Bai5/Bai5/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai5/Bai5/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai5/Bai5/bin/Class/HoDan.class b/Bai5/Bai5/bin/Class/HoDan.class
new file mode 100644
index 0000000..674cc31
Binary files /dev/null and b/Bai5/Bai5/bin/Class/HoDan.class differ
diff --git a/Bai5/Bai5/bin/Class/KhuPho.class b/Bai5/Bai5/bin/Class/KhuPho.class
new file mode 100644
index 0000000..cb492e8
Binary files /dev/null and b/Bai5/Bai5/bin/Class/KhuPho.class differ
diff --git a/Bai5/Bai5/bin/Class/Nguoi.class b/Bai5/Bai5/bin/Class/Nguoi.class
new file mode 100644
index 0000000..2305188
Binary files /dev/null and b/Bai5/Bai5/bin/Class/Nguoi.class differ
diff --git a/Bai5/Bai5/bin/Testing/Test.class b/Bai5/Bai5/bin/Testing/Test.class
new file mode 100644
index 0000000..8a2f0a8
Binary files /dev/null and b/Bai5/Bai5/bin/Testing/Test.class differ
diff --git a/Bai5/Bai5/src/Class/HoDan.java b/Bai5/Bai5/src/Class/HoDan.java
new file mode 100644
index 0000000..e0efa82
--- /dev/null
+++ b/Bai5/Bai5/src/Class/HoDan.java
@@ -0,0 +1,61 @@
+package Class;
+
+import java.util.Date;
+import java.util.Scanner;
+
+public class HoDan extends Nguoi {
+ // thuoc tinh
+ private int soNguoi;
+ private int soNha;
+ private Nguoi[] list; // list la mang danh sach chua cac thanh vien trong ho
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public HoDan() {
+ list = new Nguoi[10];
+ }
+
+ // ham khoi tao co doi so
+ public HoDan(String hoTen, Date ngaySinh, String ngheNghiep, int soNguoi, int soNha) {
+ super(hoTen, ngaySinh, ngheNghiep);
+ this.soNguoi = soNguoi;
+ this.soNha = soNha;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap so nguoi: ");
+ soNguoi = sc.nextInt();
+ sc.nextLine();
+ System.out.print("\tNhap so nha: ");
+ soNha = sc.nextInt();
+ sc.nextLine();
+ System.out.println("\tNhap thong tin cho tung nguoi trong ho:");
+ for (int i = 0; i < soNguoi; i++) {
+ System.out.println("Nguoi thu " + (i + 1) + " la:");
+ list[i] = new Nguoi();
+ list[i].nhapThongTin(sc);
+ }
+ }
+
+ // hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tSo nguoi: " + soNguoi);
+ System.out.println("\tSo nha: " + soNha);
+ System.out.println("\tThong tin cua tung nguoi trong gia dinh:");
+ for (int i = 0; i < soNguoi; i++) {
+ System.out.println("Nguoi thu " + (i + 1) + " la:");
+ list[i].hienThiThongTin();
+ }
+ }
+
+ // ham lay ra thanh vien trong ho dan
+ public Nguoi[] getList() {
+ return list;
+ }
+
+ // ham lay ra so thanh vien trong ho gia dinh
+ public int getSoNguoi() {
+ return soNguoi;
+ }
+}
diff --git a/Bai5/Bai5/src/Class/KhuPho.java b/Bai5/Bai5/src/Class/KhuPho.java
new file mode 100644
index 0000000..8cadfa8
--- /dev/null
+++ b/Bai5/Bai5/src/Class/KhuPho.java
@@ -0,0 +1,66 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Scanner;
+
+public class KhuPho {
+ // thuoc tinh
+ private ArrayList dshd;
+
+ // phuong thuc
+ // ham khoi tao
+ public KhuPho() {
+ dshd = new ArrayList(10);
+ }
+
+ // ham them 1 ho dan
+ public void themHoDan(HoDan hoDan) {
+ dshd.add(hoDan);
+ }
+
+ // ham nhap vao danh sach ho dan
+ public void nhapDanhSach(Scanner sc) {
+ HoDan hoDan;
+
+ System.out.print("Nhap vao so ho dan: ");
+ int soHoDan = sc.nextInt();
+ sc.nextLine();
+
+ System.out.println("Nhap vao thong tin cho tung ho dan:");
+ for (int i = 0; i < soHoDan; i++) {
+ System.out.println("Ho dan thu " + (i + 1) + " la:");
+ hoDan = new HoDan();
+ hoDan.nhapThongTin(sc);
+ themHoDan(hoDan);
+ }
+ }
+
+ // ham hien thi danh sach
+ public void hienThiDanhSach() {
+ int n = dshd.size();
+
+ for (int i = 0; i < n; i++) {
+ System.out.println("Ho dan thu " + (i + 1) + " la:");
+ dshd.get(i).hienThiThongTin();
+ }
+ }
+
+ // ham tim kiem thong tin
+ public void timKiemThongTin() {
+ // lay ra duoc nam hien tai
+ Date now = new Date();
+ int namHienTai = now.getYear() + 1900;
+
+ Nguoi[] dstv = null;
+
+ for (HoDan hoDan : dshd) {
+ dstv = hoDan.getList();
+ for (int i = 0; i < hoDan.getSoNguoi(); i++) {
+ if (namHienTai - (dstv[i].getNgaySinh().getYear() + 1900) == 80) {
+ hoDan.hienThiThongTin();
+ }
+ }
+ }
+ }
+}
diff --git a/Bai5/Bai5/src/Class/Nguoi.java b/Bai5/Bai5/src/Class/Nguoi.java
new file mode 100644
index 0000000..cf27dae
--- /dev/null
+++ b/Bai5/Bai5/src/Class/Nguoi.java
@@ -0,0 +1,73 @@
+package Class;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Scanner;
+
+public class Nguoi {
+ // thuoc tinh
+ private String hoTen;
+ private Date ngaySinh;
+ private String ngheNghiep;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public Nguoi() {
+
+ }
+
+ // ham khoi tao co doi so
+ public Nguoi(String hoTen, Date ngaySinh, String ngheNghiep) {
+ this.hoTen = hoTen;
+ this.ngaySinh = ngaySinh;
+ this.ngheNghiep = ngheNghiep;
+ }
+
+ // nhap cac thong tung nguoi trong ho gia dinh
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ho ten: ");
+ hoTen = sc.nextLine();
+ System.out.print("\tNhap ngay sinh: ");
+ String strDate = sc.nextLine();
+ ngaySinh = strToDate(strDate);
+ System.out.print("\tNhap nghe nghiep: ");
+ ngheNghiep = sc.nextLine();
+ }
+
+ // ham thuc hien chuyen string sang date
+ private Date strToDate(String strDate) {
+ Date date = null;
+
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+
+ try {
+ date = sdf.parse(strDate);
+ } catch (ParseException e) {
+ System.out.println("Loi dinh dang ngay thang!");
+ }
+
+ return date;
+ }
+
+ // hien thi ra tung nguoi
+ public void hienThiThongTin() {
+ System.out.println("\tHo ten: " + hoTen);
+ System.out.println("\tNgay sinh: " + dateToString(ngaySinh));
+ System.out.println("\tNghe nghiep: " + ngheNghiep);
+ }
+
+ // ham chuyen dinh dang tu date sang String
+ private String dateToString(Date date) {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+
+ String strDate = sdf.format(date);
+
+ return strDate;
+ }
+
+ // ham lay thong tin ve ngay sinh
+ public Date getNgaySinh() {
+ return ngaySinh;
+ }
+}
diff --git a/Bai5/Bai5/src/Testing/Test.java b/Bai5/Bai5/src/Testing/Test.java
new file mode 100644
index 0000000..d765353
--- /dev/null
+++ b/Bai5/Bai5/src/Testing/Test.java
@@ -0,0 +1,20 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.KhuPho;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ KhuPho qlkp = new KhuPho();
+
+ qlkp.nhapDanhSach(sc);
+
+ System.out.println("Danh sach ho dan co nguoi 80 tuoi la:");
+ qlkp.timKiemThongTin();
+ }
+
+}
diff --git a/Bai6/Bai6/.classpath b/Bai6/Bai6/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai6/Bai6/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai6/Bai6/.project b/Bai6/Bai6/.project
new file mode 100644
index 0000000..c3c00cd
--- /dev/null
+++ b/Bai6/Bai6/.project
@@ -0,0 +1,28 @@
+
+
+ Bai6
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272597
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai6/Bai6/.settings/org.eclipse.jdt.core.prefs b/Bai6/Bai6/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai6/Bai6/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai6/Bai6/bin/Class/KhachSan.class b/Bai6/Bai6/bin/Class/KhachSan.class
new file mode 100644
index 0000000..246c68a
Binary files /dev/null and b/Bai6/Bai6/bin/Class/KhachSan.class differ
diff --git a/Bai6/Bai6/bin/Class/KhachTro.class b/Bai6/Bai6/bin/Class/KhachTro.class
new file mode 100644
index 0000000..f2ad168
Binary files /dev/null and b/Bai6/Bai6/bin/Class/KhachTro.class differ
diff --git a/Bai6/Bai6/bin/Class/Nguoi.class b/Bai6/Bai6/bin/Class/Nguoi.class
new file mode 100644
index 0000000..b25d26a
Binary files /dev/null and b/Bai6/Bai6/bin/Class/Nguoi.class differ
diff --git a/Bai6/Bai6/bin/Testing/Test.class b/Bai6/Bai6/bin/Testing/Test.class
new file mode 100644
index 0000000..6999153
Binary files /dev/null and b/Bai6/Bai6/bin/Testing/Test.class differ
diff --git a/Bai6/Bai6/src/Class/KhachSan.java b/Bai6/Bai6/src/Class/KhachSan.java
new file mode 100644
index 0000000..decd9ff
--- /dev/null
+++ b/Bai6/Bai6/src/Class/KhachSan.java
@@ -0,0 +1,57 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class KhachSan {
+ // thuoc tinh
+ private ArrayList ds;
+
+ // phuong thuc
+ // ham khoi tao
+ public KhachSan() {
+ ds = new ArrayList(10);
+ }
+
+ // ham them khach tro vao khach san
+ public void themKhachTro(KhachTro kt) {
+ ds.add(kt);
+ }
+
+ // ham nhap danh sach
+ public void nhapDanhSach(Scanner sc) {
+ KhachTro khach;
+
+ System.out.print("Nhap vao so luong khach: ");
+ int n = sc.nextInt();
+ sc.nextLine();
+
+ System.out.println("Nhap vao thong tin khach tro:");
+ for (int i = 0; i < n; i++) {
+ System.out.println("Khach tro thu " + (i + 1) + " la:");
+ khach = new KhachTro();
+ khach.nhapThongTin(sc);
+ themKhachTro(khach);
+ }
+ }
+
+ // ham hien thi
+ public void hienThiDanhSach() {
+ for (KhachTro khach : ds) {
+ khach.hienThiThongTin();
+ }
+ }
+
+ // ham tinh tien
+ public double tinhTien(int CMND) {
+ double tien = 0;
+
+ for (KhachTro khach : ds) {
+ if (khach.getCMND() == CMND) {
+ tien = khach.getSoNgayTro() * khach.getGiaPhong();
+ }
+ }
+
+ return tien;
+ }
+}
diff --git a/Bai6/Bai6/src/Class/KhachTro.java b/Bai6/Bai6/src/Class/KhachTro.java
new file mode 100644
index 0000000..d49a4a0
--- /dev/null
+++ b/Bai6/Bai6/src/Class/KhachTro.java
@@ -0,0 +1,58 @@
+package Class;
+
+import java.util.Scanner;
+
+public class KhachTro extends Nguoi {
+ // thuoc tinh
+ private int soNgayTro;
+ private String loaiPhong;
+ private double giaPhong;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public KhachTro() {
+
+ }
+
+ // ham khoi tao co doi so
+ public KhachTro(String hoTen, int CMND, int soNgayTro, String loaiPhong, double giaPhong) {
+ this.hoTen = hoTen;
+ this.CMND = CMND;
+ this.soNgayTro = soNgayTro;
+ this.loaiPhong = loaiPhong;
+ this.giaPhong = giaPhong;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+
+ System.out.print("\tNhap so ngay tro: ");
+ soNgayTro = sc.nextInt();
+ sc.nextLine();
+ System.out.print("\tNhap loai phong: ");
+ loaiPhong = sc.nextLine();
+ System.out.print("\tNhap gia phong: ");
+ giaPhong = sc.nextDouble();
+ sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+
+ System.out.println("\tSo ngay tro: " + soNgayTro);
+ System.out.println("\tLoai phong: " + loaiPhong);
+ System.out.println("\tGia phong: " + giaPhong);
+ }
+
+ // ham lay ra thong tin so ngay tro
+ public int getSoNgayTro() {
+ return soNgayTro;
+ }
+
+ // ham lay thong tin gia phong
+ public double getGiaPhong() {
+ return giaPhong;
+ }
+}
diff --git a/Bai6/Bai6/src/Class/Nguoi.java b/Bai6/Bai6/src/Class/Nguoi.java
new file mode 100644
index 0000000..ce4cf62
--- /dev/null
+++ b/Bai6/Bai6/src/Class/Nguoi.java
@@ -0,0 +1,62 @@
+package Class;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Scanner;
+
+public class Nguoi {
+ // thuoc tinh
+ protected String hoTen;
+ protected Date ngaySinh;
+ protected int CMND;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public Nguoi() {
+
+ }
+
+ // ham khoi tao co doi so
+ public Nguoi(String hoTen, Date ngaySinh, int CMND) {
+ this.hoTen = hoTen;
+ this.ngaySinh = ngaySinh;
+ this.CMND = CMND;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ho ten: ");
+ hoTen = sc.nextLine();
+ System.out.print("\tNhap ngay sinh: ");
+ String strDate = sc.nextLine();
+ ngaySinh = strToDate(strDate);
+ System.out.print("\tNhap CMND: ");
+ CMND = sc.nextInt();
+ }
+
+ private Date strToDate(String strDate) {
+ Date date = null;
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+
+ try {
+ date = sdf.parse(strDate);
+ } catch (ParseException e) {
+ System.out.println("Loi dinh dang ngay thang!");
+ }
+
+ return date;
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tHo ten: " + hoTen);
+ System.out.println("\tNgay sinh: " + ngaySinh);
+ System.out.println("\tCMND: " + CMND);
+ }
+
+ // ham lay ra thong tin CMND
+ public int getCMND() {
+ return CMND;
+ }
+}
diff --git a/Bai6/Bai6/src/Testing/Test.java b/Bai6/Bai6/src/Testing/Test.java
new file mode 100644
index 0000000..e9d494d
--- /dev/null
+++ b/Bai6/Bai6/src/Testing/Test.java
@@ -0,0 +1,24 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.KhachSan;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ KhachSan ql = new KhachSan();
+
+ ql.nhapDanhSach(sc);
+
+ System.out.print("Nhap vao khach tro can tinh tien: ");
+ int cmnd = sc.nextInt();
+
+ System.out.println("==> Tong tien la: " + ql.tinhTien(cmnd));
+
+ sc.close();
+ }
+
+}
diff --git a/Bai7/Bai7/.classpath b/Bai7/Bai7/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai7/Bai7/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai7/Bai7/.project b/Bai7/Bai7/.project
new file mode 100644
index 0000000..35ffd2f
--- /dev/null
+++ b/Bai7/Bai7/.project
@@ -0,0 +1,28 @@
+
+
+ Bai7
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272605
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai7/Bai7/.settings/org.eclipse.jdt.core.prefs b/Bai7/Bai7/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai7/Bai7/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai7/Bai7/bin/Class/HocSinh.class b/Bai7/Bai7/bin/Class/HocSinh.class
new file mode 100644
index 0000000..5f2738f
Binary files /dev/null and b/Bai7/Bai7/bin/Class/HocSinh.class differ
diff --git a/Bai7/Bai7/bin/Class/Nguoi.class b/Bai7/Bai7/bin/Class/Nguoi.class
new file mode 100644
index 0000000..d93885f
Binary files /dev/null and b/Bai7/Bai7/bin/Class/Nguoi.class differ
diff --git a/Bai7/Bai7/bin/Class/QLHS.class b/Bai7/Bai7/bin/Class/QLHS.class
new file mode 100644
index 0000000..3e2954f
Binary files /dev/null and b/Bai7/Bai7/bin/Class/QLHS.class differ
diff --git a/Bai7/Bai7/bin/Testing/Test.class b/Bai7/Bai7/bin/Testing/Test.class
new file mode 100644
index 0000000..b78a9ba
Binary files /dev/null and b/Bai7/Bai7/bin/Testing/Test.class differ
diff --git a/Bai7/Bai7/src/Class/HocSinh.java b/Bai7/Bai7/src/Class/HocSinh.java
new file mode 100644
index 0000000..bb12ffd
--- /dev/null
+++ b/Bai7/Bai7/src/Class/HocSinh.java
@@ -0,0 +1,52 @@
+package Class;
+
+import java.util.Scanner;
+
+public class HocSinh extends Nguoi {
+ // thuoc tinh
+ private String lop;
+ private String khoHoc;
+ private String kyHoc;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public HocSinh() {
+
+ }
+
+ // ham khoi tao co doi so
+ public HocSinh(String hoTen, String lop, String khoaHoc, String kyHoc) {
+ this.hoTen = hoTen;
+ this.lop = lop;
+ this.khoHoc = khoaHoc;
+ this.kyHoc = kyHoc;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+
+ System.out.print("\tNhap lop: ");
+ lop = sc.nextLine();
+
+ System.out.print("\tNhap khoa hoc: ");
+ khoHoc = sc.nextLine();
+
+ System.out.print("\tNhap ky hoc: ");
+ kyHoc = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+
+ System.out.println("\tLop: " + lop);
+ System.out.println("\tKhoa hoc: " + khoHoc);
+ System.out.println("\tKy hoc: " + kyHoc);
+ }
+
+ // ham lay ra thong tin ve lop
+ public String getLop() {
+ return lop;
+ }
+}
diff --git a/Bai7/Bai7/src/Class/Nguoi.java b/Bai7/Bai7/src/Class/Nguoi.java
new file mode 100644
index 0000000..d84603f
--- /dev/null
+++ b/Bai7/Bai7/src/Class/Nguoi.java
@@ -0,0 +1,70 @@
+package Class;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Scanner;
+
+public class Nguoi {
+ // thuoc tinh
+ protected String hoTen;
+ protected Date ngaySinh;
+ protected String queQuan;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public Nguoi() {
+
+ }
+
+ // ham khoi tao co doi so
+ public Nguoi(String hoTen, Date ngaySinh, String queQuan) {
+ this.hoTen = hoTen;
+ this.ngaySinh = ngaySinh;
+ this.queQuan = queQuan;
+ }
+
+ // ham nhap vao thong tin
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ho ten: ");
+ hoTen = sc.nextLine();
+
+ System.out.print("\tNhap ngay sinh: ");
+ String strDate = sc.nextLine();
+ ngaySinh = strToDate(strDate);
+
+ System.out.print("\tNhap que quan: ");
+ queQuan = sc.nextLine();
+ }
+
+ private Date strToDate(String strDate) {
+ Date date = null;
+
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+
+ try {
+ date = sdf.parse(strDate);
+ } catch (ParseException e) {
+ System.out.println("Loi dinh dang ngay thang!");
+ }
+
+ return date;
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tHo ten: " + hoTen);
+ System.out.println("\tNgay sinh: " + ngaySinh);
+ System.out.println("\tQue quan: " + queQuan);
+ }
+
+ // ham lay ra que quan
+ public String getQueQuan() {
+ return queQuan;
+ }
+
+ // ham lay ra thong tin ve ngay sinh
+ public Date getNgaySinh() {
+ return ngaySinh;
+ }
+}
diff --git a/Bai7/Bai7/src/Class/QLHS.java b/Bai7/Bai7/src/Class/QLHS.java
new file mode 100644
index 0000000..95a4c52
--- /dev/null
+++ b/Bai7/Bai7/src/Class/QLHS.java
@@ -0,0 +1,64 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class QLHS {
+ // thuoc tinh
+ private ArrayList dshs;
+
+ // phuong thuc
+ // ham khoi tao
+ public QLHS() {
+ dshs = new ArrayList(10);
+ }
+
+ // ham them hoc sinh
+ public void themHS(HocSinh hs) {
+ dshs.add(hs);
+ }
+
+ // ham nhap danh sach
+ public void nhapDanhSachHS(Scanner sc) {
+ HocSinh hs;
+
+ System.out.print("Nhap vao so luong hoc sinh: ");
+ int n = sc.nextInt();
+
+ System.out.println("Nhap thong tin cho hoc sinh trong danh sach:");
+ for (int i = 0; i < n; i++) {
+ System.out.println("\tHoc sinh thu " + (i + 1) + " la:");
+
+ hs = new HocSinh();
+ hs.nhapThongTin(sc);
+
+ themHS(hs);
+ }
+ }
+
+ // ham hien thi
+ public void hienThiDanhSach() {
+ int n = dshs.size();
+ for (int i = 0; i < n; i++) {
+ System.out.println("\tHoc sinh thu " + (i + 1) + " la:");
+ dshs.get(i).hienThiThongTin();
+ }
+ }
+
+ // ham tim kiem thong tin
+ public void timKiemThongTin(int nam, String que) {
+ for (HocSinh hs : dshs) {
+ if ((hs.getNgaySinh().getYear() + 1900 == nam) && (que.equals(hs.getQueQuan()))) {
+ hs.hienThiThongTin();
+ }
+ }
+ }
+
+ public void timKiemThongTin(String lop) {
+ for (HocSinh hs : dshs) {
+ if (lop.equals(hs.getLop())) {
+ hs.hienThiThongTin();
+ }
+ }
+ }
+}
diff --git a/Bai7/Bai7/src/Testing/Test.java b/Bai7/Bai7/src/Testing/Test.java
new file mode 100644
index 0000000..1f5515e
--- /dev/null
+++ b/Bai7/Bai7/src/Testing/Test.java
@@ -0,0 +1,25 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.QLHS;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc=new Scanner(System.in);
+
+ QLHS list=new QLHS();
+
+ list.nhapDanhSachHS(sc);
+
+ System.out.print("Nhung hoc sinh sinh nam 1985 va que Thai Nguyen la:");
+ list.timKiemThongTin(1985, "Thai Nguyen");
+
+ System.out.println("Nhung hoc sinh hoc lop 10A1 la:");
+ list.timKiemThongTin("10A1");
+
+ sc.close();
+ }
+
+}
diff --git a/Bai8/Bai8/.classpath b/Bai8/Bai8/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai8/Bai8/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai8/Bai8/.project b/Bai8/Bai8/.project
new file mode 100644
index 0000000..1279f85
--- /dev/null
+++ b/Bai8/Bai8/.project
@@ -0,0 +1,28 @@
+
+
+ Bai8
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272615
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai8/Bai8/.settings/org.eclipse.jdt.core.prefs b/Bai8/Bai8/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai8/Bai8/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai8/Bai8/bin/Class/CBGV.class b/Bai8/Bai8/bin/Class/CBGV.class
new file mode 100644
index 0000000..c4179f3
Binary files /dev/null and b/Bai8/Bai8/bin/Class/CBGV.class differ
diff --git a/Bai8/Bai8/bin/Class/Nguoi.class b/Bai8/Bai8/bin/Class/Nguoi.class
new file mode 100644
index 0000000..1aefa91
Binary files /dev/null and b/Bai8/Bai8/bin/Class/Nguoi.class differ
diff --git a/Bai8/Bai8/bin/Class/QuanLy.class b/Bai8/Bai8/bin/Class/QuanLy.class
new file mode 100644
index 0000000..4e559c0
Binary files /dev/null and b/Bai8/Bai8/bin/Class/QuanLy.class differ
diff --git a/Bai8/Bai8/bin/Testing/Test.class b/Bai8/Bai8/bin/Testing/Test.class
new file mode 100644
index 0000000..a72e600
Binary files /dev/null and b/Bai8/Bai8/bin/Testing/Test.class differ
diff --git a/Bai8/Bai8/src/Class/CBGV.java b/Bai8/Bai8/src/Class/CBGV.java
new file mode 100644
index 0000000..d29b331
--- /dev/null
+++ b/Bai8/Bai8/src/Class/CBGV.java
@@ -0,0 +1,52 @@
+package Class;
+
+import java.util.Scanner;
+
+public class CBGV extends Nguoi {
+ // thuoc tinh
+ private double luongCung;
+ private double thuong;
+ private double phat;
+ private double luongThucLinh;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public CBGV() {
+
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+
+ System.out.print("\tNhap luong cung: ");
+ luongCung = sc.nextDouble();
+ sc.nextLine();
+
+ System.out.print("\tNhap thuong: ");
+ thuong = sc.nextDouble();
+ sc.nextLine();
+
+ System.out.print("\tNhap phat: ");
+ phat = sc.nextDouble();
+ sc.nextLine();
+
+ // tinh luong
+ luongThucLinh = luongCung + thuong - phat;
+ }
+
+ // ham hien thi thong tin
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+
+ System.out.println("\tLuong cung: " + luongCung);
+ System.out.println("\tThuong: " + thuong);
+ System.out.println("\tPhat: " + phat);
+ System.out.println("\tLuong thuc linh: " + luongThucLinh);
+ }
+
+ // ham lay ra thong tin ve luong thuc linh
+ public double getLuongThucLinh() {
+ return luongThucLinh;
+ }
+}
diff --git a/Bai8/Bai8/src/Class/Nguoi.java b/Bai8/Bai8/src/Class/Nguoi.java
new file mode 100644
index 0000000..5dea258
--- /dev/null
+++ b/Bai8/Bai8/src/Class/Nguoi.java
@@ -0,0 +1,40 @@
+package Class;
+
+import java.util.Scanner;
+
+public class Nguoi {
+ // thuoc tinh
+ protected String hoTen;
+ protected String ngaySinh;
+ protected String queQuan;
+
+ // phuong thuc
+ // ham khoi tao khong so
+ public Nguoi() {
+
+ }
+
+ // ham khoi tao co doi so
+ public Nguoi(String hoTen, String ngaySinh, String queQuan) {
+ this.hoTen = hoTen;
+ this.ngaySinh = ngaySinh;
+ this.queQuan = queQuan;
+ }
+
+ // ham nhap thong tin
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ho ten: ");
+ hoTen = sc.nextLine();
+ System.out.print("\tNhap ngay sinh: ");
+ ngaySinh = sc.nextLine();
+ System.out.print("\tNhap que quan: ");
+ queQuan = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tHo ten: " + hoTen);
+ System.out.println("\tNgay sinh: " + ngaySinh);
+ System.out.println("\tQue quan: " + queQuan);
+ }
+}
diff --git a/Bai8/Bai8/src/Class/QuanLy.java b/Bai8/Bai8/src/Class/QuanLy.java
new file mode 100644
index 0000000..7b6aaa1
--- /dev/null
+++ b/Bai8/Bai8/src/Class/QuanLy.java
@@ -0,0 +1,53 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class QuanLy {
+ // thuoc tinh
+ private ArrayList ds;
+
+ // phuong thuc
+ // ham khoi tao
+ public QuanLy() {
+ ds = new ArrayList(10);
+ }
+
+ // ham them can bo vao danh sach
+ public void themCBGV(CBGV canBo) {
+ ds.add(canBo);
+ }
+
+ // ham nhap vao danh sach
+ public void nhapDanhSach(Scanner sc) {
+ CBGV canBo;
+
+ System.out.print("Nhap vao so luong can bo: ");
+ int n = sc.nextInt();
+ sc.nextLine();
+
+ System.out.println("Nhap vao danh sach:");
+ for (int i = 0; i < n; i++) {
+ System.out.println("Can bo thu " + (i + 1) + " la:");
+ canBo = new CBGV();
+ canBo.nhapThongTin(sc);
+ themCBGV(canBo);
+ }
+ }
+
+ // ham hien thi danh sach
+ public void hienThiDanhSach() {
+ for (CBGV cb : ds) {
+ cb.hienThiThongTin();
+ }
+ }
+
+ // ham tim kiem
+ public void timKiem(double luong) {
+ for (CBGV cb : ds) {
+ if (cb.getLuongThucLinh() >= luong) {
+ cb.hienThiThongTin();
+ }
+ }
+ }
+}
diff --git a/Bai8/Bai8/src/Testing/Test.java b/Bai8/Bai8/src/Testing/Test.java
new file mode 100644
index 0000000..c5c796d
--- /dev/null
+++ b/Bai8/Bai8/src/Testing/Test.java
@@ -0,0 +1,22 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.QuanLy;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ QuanLy ql = new QuanLy();
+
+ ql.nhapDanhSach(sc);
+
+ System.out.println("Danh sach nhung can bo co luong >= 8 trieu la:");
+ ql.timKiem(8000000);
+
+ sc.close();
+ }
+
+}
diff --git a/Bai9/Bai9/.classpath b/Bai9/Bai9/.classpath
new file mode 100644
index 0000000..51a8bba
--- /dev/null
+++ b/Bai9/Bai9/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Bai9/Bai9/.project b/Bai9/Bai9/.project
new file mode 100644
index 0000000..b972449
--- /dev/null
+++ b/Bai9/Bai9/.project
@@ -0,0 +1,28 @@
+
+
+ Bai9
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
+
+ 1671125272630
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Bai9/Bai9/.settings/org.eclipse.jdt.core.prefs b/Bai9/Bai9/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ec1937b
--- /dev/null
+++ b/Bai9/Bai9/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Bai9/Bai9/bin/Class/QuanLy.class b/Bai9/Bai9/bin/Class/QuanLy.class
new file mode 100644
index 0000000..3c303c4
Binary files /dev/null and b/Bai9/Bai9/bin/Class/QuanLy.class differ
diff --git a/Bai9/Bai9/bin/Class/SinhVien.class b/Bai9/Bai9/bin/Class/SinhVien.class
new file mode 100644
index 0000000..3abe555
Binary files /dev/null and b/Bai9/Bai9/bin/Class/SinhVien.class differ
diff --git a/Bai9/Bai9/bin/Class/TheMuon.class b/Bai9/Bai9/bin/Class/TheMuon.class
new file mode 100644
index 0000000..131a56f
Binary files /dev/null and b/Bai9/Bai9/bin/Class/TheMuon.class differ
diff --git a/Bai9/Bai9/bin/Testing/Test.class b/Bai9/Bai9/bin/Testing/Test.class
new file mode 100644
index 0000000..b2afd45
Binary files /dev/null and b/Bai9/Bai9/bin/Testing/Test.class differ
diff --git a/Bai9/Bai9/src/Class/QuanLy.java b/Bai9/Bai9/src/Class/QuanLy.java
new file mode 100644
index 0000000..d15ed92
--- /dev/null
+++ b/Bai9/Bai9/src/Class/QuanLy.java
@@ -0,0 +1,46 @@
+package Class;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class QuanLy {
+ // thuoc tinh
+ private ArrayList ds;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public QuanLy() {
+ ds = new ArrayList(10);
+ }
+
+ // ham them the muon vao danh sach
+ public void themTheMuon(TheMuon theMuon) {
+ ds.add(theMuon);
+ }
+
+ // ham nhap vao danh sach
+ public void nhapDanhSach(Scanner sc) {
+ TheMuon theMuon;
+
+ System.out.print("Nhap vao so luong the muon: ");
+ int n = sc.nextInt();
+ sc.nextLine();
+
+ System.out.println("Nhap vao danh sach:");
+ for (int i = 0; i < n; i++) {
+ System.out.println("The muon thu " + (i + 1) + " la:");
+ theMuon = new TheMuon();
+ theMuon.nhapThongTin(sc);
+ themTheMuon(theMuon);
+ }
+ }
+
+ // ham hien thi danh sach
+ public void hienThiDanhSachTraCuoiThang() {
+ for (TheMuon the : ds) {
+ if (the.getHanTra().getDate() == 31 || the.getHanTra().getDate() == 30) {
+ the.hienThiThongTin();
+ }
+ }
+ }
+}
diff --git a/Bai9/Bai9/src/Class/SinhVien.java b/Bai9/Bai9/src/Class/SinhVien.java
new file mode 100644
index 0000000..3fdbd60
--- /dev/null
+++ b/Bai9/Bai9/src/Class/SinhVien.java
@@ -0,0 +1,48 @@
+package Class;
+
+import java.util.Scanner;
+
+public class SinhVien {
+ // thuoc tinh
+ protected String hoTen;
+ protected String maSV;
+ protected String ngaySinh;
+ protected String lop;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public SinhVien() {
+
+ }
+
+ // ham khoi tao co doi so
+ public SinhVien(String hoTen, String maSV, String ngaySinh, String lop) {
+ this.hoTen = hoTen;
+ this.maSV = maSV;
+ this.ngaySinh = ngaySinh;
+ this.lop = lop;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ System.out.print("\tNhap ho ten: ");
+ hoTen = sc.nextLine();
+
+ System.out.print("\tNhap ma sinh vien: ");
+ maSV = sc.nextLine();
+
+ System.out.print("\tNhap ngay sinh: ");
+ ngaySinh = sc.nextLine();
+
+ System.out.print("\tNhap lop: ");
+ lop = sc.nextLine();
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ System.out.println("\tHo ten: " + hoTen);
+ System.out.println("\tNgay sinh: " + ngaySinh);
+ System.out.println("\tMa sinh vien: " + maSV);
+ System.out.println("\tLop: " + lop);
+ }
+}
diff --git a/Bai9/Bai9/src/Class/TheMuon.java b/Bai9/Bai9/src/Class/TheMuon.java
new file mode 100644
index 0000000..1ab7820
--- /dev/null
+++ b/Bai9/Bai9/src/Class/TheMuon.java
@@ -0,0 +1,75 @@
+package Class;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Scanner;
+
+public class TheMuon extends SinhVien {
+ // thuoc tinh
+ private int soMuon;
+ private Date ngayMuon;
+ private Date hanTra;
+ private String soHieu;
+
+ // phuong thuc
+ // ham khoi tao khong doi so
+ public TheMuon() {
+
+ }
+
+ // ham khoi tao co doi so
+ public TheMuon(int soMuon, Date ngayMuon, String soHieu) {
+ this.soMuon = soMuon;
+ this.ngayMuon = ngayMuon;
+ this.soHieu = soHieu;
+ }
+
+ // ham nhap
+ public void nhapThongTin(Scanner sc) {
+ super.nhapThongTin(sc);
+
+ System.out.print("\tNhap so muon: ");
+ soMuon = sc.nextInt();
+ sc.nextLine();
+
+ System.out.print("\tNhap ngay muon: ");
+ String strNgayMuon = sc.nextLine();
+ ngayMuon = strToDate(strNgayMuon);
+
+ String strNgayTra = "31-12-2020";
+ hanTra = strToDate(strNgayTra);
+
+ System.out.println("\tNhap so hieu: ");
+ soHieu = sc.nextLine();
+ }
+
+ private Date strToDate(String strNgayMuon) {
+ Date date = null;
+
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+
+ try {
+ date = sdf.parse(strNgayMuon);
+ } catch (ParseException e) {
+ System.out.println("Loi dinh dang ngay thang!");
+ }
+
+ return date;
+ }
+
+ // ham hien thi
+ public void hienThiThongTin() {
+ super.hienThiThongTin();
+
+ System.out.println("\tSo phieu muon: " + soMuon);
+ System.out.println("\tNgay muon: " + ngayMuon);
+ System.out.println("\tHan tra: " + hanTra);
+ System.out.println("\tSo hieu: " + soHieu);
+ }
+
+ // ham lay ra thong tin ve han tra
+ public Date getHanTra() {
+ return hanTra;
+ }
+}
diff --git a/Bai9/Bai9/src/Testing/Test.java b/Bai9/Bai9/src/Testing/Test.java
new file mode 100644
index 0000000..63eb244
--- /dev/null
+++ b/Bai9/Bai9/src/Testing/Test.java
@@ -0,0 +1,22 @@
+package Testing;
+
+import java.util.Scanner;
+
+import Class.QuanLy;
+
+public class Test {
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+
+ QuanLy ql = new QuanLy();
+
+ ql.nhapDanhSach(sc);
+
+ System.out.println("Danh sach sinh vien tra sach vao cuoi thang:");
+ ql.hienThiDanhSachTraCuoiThang();
+
+ sc.close();
+ }
+
+}
diff --git a/Java/1.10.java b/Java/1.10.java
new file mode 100644
index 0000000..142a762
--- /dev/null
+++ b/Java/1.10.java
@@ -0,0 +1,81 @@
+// EX 1.10 Write a program to get next day of a given date
+// Write a program to get next day of a given date.
+
+// Please don't use any library of Java.
+
+// Test data 1
+// Input: 2020, 02, 29
+// Output: 2020, 03, 01
+import java.util.Scanner;
+public class Main {
+ public static void main(String[] Strings) {
+ Scanner scanner = new Scanner(System.in);
+ String string = scanner.nextLine();
+ var year = string.substring(0,4);
+ int nam = Integer.parseInt(year);
+ var month = string.substring(6,8);
+ int thang = Integer.parseInt(month);
+ var day = string.substring(10,12);
+ int ngay = Integer.parseInt(day);
+ boolean nhuan = true;
+ int i;
+ if (nam % 400 == 0) {
+ nhuan = true;
+ }
+ else if (nam % 100 == 0) {
+ nhuan = false;
+ }
+ else if (nam % 4 == 0) {
+ nhuan = true;
+ }
+ else {
+ nhuan = false;
+ }
+
+ if (thang == 1 || thang == 3 || thang == 5 || thang == 7 || thang == 8 || thang == 10 || thang == 12) {
+ i = 31;
+ }
+ else if (thang == 2) {
+ if (nhuan) {
+ i = 29;
+ }
+ else {
+ i = 28;
+ }
+ }
+ else {
+ i = 30;
+ }
+
+ if (ngay < i) {
+ ngay = ngay + 1;
+ }
+ else {
+ ngay = 1;
+ if (thang == 12) {
+ thang = 1;
+ nam = nam + 1;
+ }
+ else {
+ thang = thang + 1;
+ }
+ }
+ System.out.print(nam);
+ System.out.print(", ");
+ if (thang < 10) {
+ System.out.print("0");
+ System.out.print(thang);
+ }
+ else {
+ System.out.print(thang);
+ }
+ System.out.print(", ");
+ if (ngay < 10) {
+ System.out.print("0");
+ System.out.print(ngay);
+ }
+ else {
+ System.out.print(ngay);
+ }
+ }
+}
diff --git a/Java/1.2.java b/Java/1.2.java
new file mode 100644
index 0000000..cd849f0
--- /dev/null
+++ b/Java/1.2.java
@@ -0,0 +1,26 @@
+// EX 1.2 Write a program that takes a year from the user and print whether that year is a leap year or not.
+// Write a program that takes a year from the user and print whether that year is a leap year or not.
+// Test Data
+
+// Input the year: 2016
+
+// Expected Output : True
+import java.util.Scanner;
+
+public class Main {
+
+ public static void main(String[] args) {
+ try (Scanner scanner = new Scanner(System.in)) {
+ int year = scanner.nextInt();
+ if ( year % 4 == 0 && year % 100 != 0) {
+ System.out.print("True");
+ }
+ else if ( year % 400 == 0) {
+ System.out.print("True");
+ }
+ else {
+ System.out.print("False");
+ }
+ }
+ }
+}
diff --git a/oop_employee_management/.idea/sonarlint/issuestore/index.pb b/Java/1.3.java
similarity index 100%
rename from oop_employee_management/.idea/sonarlint/issuestore/index.pb
rename to Java/1.3.java
diff --git a/Java/1.4.java b/Java/1.4.java
new file mode 100644
index 0000000..9bdc8d6
--- /dev/null
+++ b/Java/1.4.java
@@ -0,0 +1,65 @@
+// EX 1.4. Write a program which reads a sequence of integers and prints how often each number of this sequence occurs.
+// Write a program which reads a sequence of integers and prints how often each number of this sequence occurs.
+
+// Example
+
+// Input:
+
+// 9
+
+// 1 3 5 7 5 3 7 2 5
+
+// Output:
+
+// 1(1), 3(2), 5(3), 7(2), 2(1)
+
+
+
+// Please note that:
+
+// 9 as array size
+
+// 1 3 5 7 5 3 7 2 5 as array
+import java.util.Scanner;
+
+public class Main {
+
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ int a = scanner.nextInt();
+ int[] arr = new int[a];
+ for (int i = 0; i < a; i++) {
+ arr[i] = scanner.nextInt();
+ }
+
+ boolean check = true;
+ boolean first = true;
+ for (int i = 0; i < arr.length; i++) {
+ check = true;
+ for (int j = 0; j < i; j++) {
+ if (arr[i] == arr[j]) {
+ check = false;
+ break;
+ }
+ }
+
+ if (check == true) {
+ int sum = 1;
+ for (int j = i + 1; j < arr.length; j++) {
+ if (arr[j] == arr[i]) {
+ sum++;
+ }
+ }
+ if (first == true) {
+ System.out.print(arr[i] + "(" + sum + ")");
+ first = false;
+ } else {
+ System.out.print(", " + arr[i] + "(" + sum + ")");
+ }
+
+ }
+ }
+
+ }
+}
+
diff --git a/Java/1.5.java b/Java/1.5.java
new file mode 100644
index 0000000..1108056
--- /dev/null
+++ b/Java/1.5.java
@@ -0,0 +1,41 @@
+// EX 1.5. Write a program that accept an integer (n) from the user and outputs combinations that express n as a sum of two prime numbers.
+// Write a program that accept an integer (n) from the user and outputs combinations that express n as a sum of two prime numbers.
+
+// Example
+
+// Input: 10
+
+// Output: 7+3, 5+5
+import java.util.Scanner;
+
+public class Main {
+ private static boolean isPrime(int a) {
+ if ( a < 2) {
+ return false;
+ }
+ for ( int i = 2; i < a; i++) {
+ if ( a % i == 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ int a = scanner.nextInt();
+ boolean first = true;
+ for (int i = a -2; i >= a /2; i--) {
+ if ( isPrime(i) && isPrime(a-i)) {
+ if ( first == true) {
+ first = false;
+ System.out.print( i + "+" + (a - i));
+ }
+ else {
+ System.out.print( ", " + i + "+" + (a - i));
+ }
+ }
+ }
+ }
+}
+
diff --git a/Java/1.6.java b/Java/1.6.java
new file mode 100644
index 0000000..15c1f63
--- /dev/null
+++ b/Java/1.6.java
@@ -0,0 +1,44 @@
+// EX 1.6 Write a program to check whether the sequence of numbers 1, 2, 3 appears in a given array of integers somewhere.
+// Write a program to check whether the sequence of numbers 1, 2, 3 appears in a given array of integers somewhere.
+
+// Example
+// Input:
+// 5
+// 1 1 2 3 1
+// Output: 1
+// Please note that:
+// 5 as array size
+// 1 1 2 3 1 as array
+
+import java.util.Scanner;
+
+/**
+ * array2
+ */
+public class Main {
+ public static boolean test(int[] a) {
+ for (int i = 0; i < a.length-2 ; i++) {
+ if (a[i] == 1 && a[i + 1] == 2 && a[i + i] == 3) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+ int n = sc.nextInt();
+ int[] a = new int[n];
+ for (int i = 0; i < n; i++) {
+ a[i] = sc.nextInt();
+ }
+ if (test(a)) {
+ System.out.print(0);
+ } else {
+ System.out.print(1);
+ }
+ }
+}
+
+
+
diff --git a/Java/1.7.java b/Java/1.7.java
new file mode 100644
index 0000000..bfef6cd
--- /dev/null
+++ b/Java/1.7.java
@@ -0,0 +1,56 @@
+// EX 1.7 If a number appears three times in a row in an array it is called a triple. Write a program to check if a triple is presents in an array of integers or not.
+// If a value appears three times in a row in an array it is called a triple. Write a program to check if a triple is presents in an array of integers or not.
+
+// Example
+// Input:
+// 7
+// 1 1 1 2 2 2 1
+// Output:
+// 1
+
+// Please note that:
+
+// 7 as array size
+// 1 1 1 2 2 2 1 as array
+import java.util.Scanner;
+
+/**
+ * array2
+ */
+public class Main{
+ public static boolean test(int[] a, int n) {
+ for (int i = 0; i < n-1; i++) {
+ if (a[i] == a[i + 1] && a[i] == a[i + 2] && a[i + 1] == a[i + 2]) {
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+
+}
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+ int n = sc.nextInt();
+ int[] a = new int[n];
+ for (int i = 0; i < n; i++) {
+ a[i] = sc.nextInt();
+ }
+
+ if (test(a, n) == true) {
+ System.out.print(1);
+ } else {
+ System.out.print(0);
+ }
+ // for (int i = 0; i < a.length; i++) {
+ // System.out.print(a[i] + " ");
+ // }
+ }
+}
+
+
+
+
+
+
+
diff --git a/Java/1.8.java b/Java/1.8.java
new file mode 100644
index 0000000..53dcec5
--- /dev/null
+++ b/Java/1.8.java
@@ -0,0 +1,52 @@
+// EX 1.8 Write a program to find k largest even number in an array
+// Write a program to find k largest even number in an array with size of n.
+
+// Example
+// Input:
+// 2
+// 8
+// 4 5 9 12 9 22 45 7
+// Output:
+// 22 12
+// Please note that:
+// 2 as k
+// 8 as n
+// 4 5 9 12 9 22 45 7 as array
+
+import java.util.PriorityQueue;
+import java.util.Scanner;
+
+class GFG {
+
+ static void kLargest(int a[], int l, int k) {
+ PriorityQueue pq = new PriorityQueue();
+
+ for (int i = 0; i < l; i++) {
+ if (a[i] % 2 == 0) {
+ pq.add(a[i]);
+ if (pq.size() > k) {
+ pq.poll();
+ }
+ }
+ }
+ while (!pq.isEmpty()) {
+ System.out.print(pq.peek() + " ");
+ pq.poll();
+ }
+ System.out.println();
+ }
+
+ public static void main(String[] args) {
+ Scanner sc = new Scanner(System.in);
+ int k = sc.nextInt();
+ int n = sc.nextInt();
+ int a[] = new int[n];
+ int l = a.length;
+ for (int i = 0; i < n; i++) {
+ a[i] = sc.nextInt();
+ }
+ kLargest(a, l, k);
+
+ }
+}
+
diff --git a/Java/1.9.java b/Java/1.9.java
new file mode 100644
index 0000000..6b03b0d
--- /dev/null
+++ b/Java/1.9.java
@@ -0,0 +1,57 @@
+// EX 1.9 Write a program to separate and sort even and odd numbers of an array of integers
+// EX 2.8 Write a program to separate and sort even and odd numbers of an array of integers.
+// Put all sorted odd numbers first, and then sorted even numbers.
+// Example:
+// Input:
+// 9
+// 0 1 3 4 5 6 7 8 10
+// Output:
+// 1 3 5 7 0 4 6 8 10
+
+// Please note that:
+// 9 as size of array
+// 0 1 3 4 5 6 7 8 10 as array
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Scanner;
+
+public class Main {
+
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ int n = scanner.nextInt();
+ ArrayList oddNumbers = new ArrayList<>();
+ ArrayList evenNumbers = new ArrayList<>();
+
+ for (int i = 0; i < n; i++) {
+ int temp = 0;
+ temp = scanner.nextInt();
+ if (temp % 2 != 0) {
+ oddNumbers.add(temp);
+ } else {
+ evenNumbers.add(temp);
+ }
+ }
+ Collections.sort(oddNumbers);
+ Collections.sort(evenNumbers);
+
+ ArrayList numbers = new ArrayList<>();
+ for (Integer i : oddNumbers) {
+ numbers.add(i);
+ }
+ for (Integer i : evenNumbers) {
+ numbers.add(i);
+ }
+ boolean first = true;
+ for (Integer i : numbers) {
+ if (first) {
+ first = false;
+ System.out.print(i);
+ } else {
+ System.out.print(" " + i);
+ }
+ }
+ }
+}
+
diff --git a/README.md b/README.md
deleted file mode 100644
index d8e4fba..0000000
--- a/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bài tập về OOP
-
-[shareprogramming.net](https://shareprogramming.net/)
\ No newline at end of file
diff --git a/exercise_oop_account/Account.java b/exercise_oop_account/Account.java
deleted file mode 100644
index 96b3f83..0000000
--- a/exercise_oop_account/Account.java
+++ /dev/null
@@ -1,41 +0,0 @@
-public class Account {
- private int id;
- private String name;
- private int balance;
-
- public Account(int id, String name, int balance) {
- this.id = id;
- this.name = name;
- this.balance = balance;
- }
-
- public String getName() {
- return name;
- }
-
- public int getBalance() {
- return balance;
- }
-
- public void credit(int amount) {
- this.balance += amount;
- }
-
- public void debit(int amount) {
- if (amount > this.balance) {
- System.out.println("Thanh Toan khong thanh cong");
- } else {
- this.balance -= amount;
- }
- }
-
- public void tranferTo(Account account, int amount) {
- if (amount > this.balance) {
- System.out.println("Chuyen tien khong thanh cong");
- } else {
- // Tru tien tai khoan chuyen
- this.balance -= amount;
- account.credit(amount);
- }
- }
-}
diff --git a/exercise_oop_account/Main.java b/exercise_oop_account/Main.java
deleted file mode 100644
index 1c15ee1..0000000
--- a/exercise_oop_account/Main.java
+++ /dev/null
@@ -1,35 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Account a = new Account(1, "A", 50);
- Account b = new Account(1, "B", 10);
-
- System.out.println("Balance A: " + a.getBalance());
- System.out.println("Balance B: " + b.getBalance());
- System.out.println();
-
- // Cong tien vao tai khoan
- a.credit(30);
- System.out.println("Balance A: " + a.getBalance());
- System.out.println("Balance B: " + b.getBalance());
- System.out.println();
-
- // Tru tien vao tai khoan
- a.debit(20);
- System.out.println("Balance A: " + a.getBalance());
- System.out.println("Balance B: " + b.getBalance());
- System.out.println();
-
- // Tru tien vao tai khoan khong hop le
- a.debit(1000);
- System.out.println("Balance A: " + a.getBalance());
- System.out.println("Balance B: " + b.getBalance());
- System.out.println();
-
- // Chuyen tien cho b
- a.tranferTo(b, 10);
- System.out.println("Balance A: " + a.getBalance());
- System.out.println("Balance B: " + b.getBalance());
- System.out.println();
- }
-}
diff --git a/exercise_oop_composition_book_author/exercise_oop_composition_book_author.iml b/exercise_oop_composition_book_author/exercise_oop_composition_book_author.iml
deleted file mode 100644
index c90834f..0000000
--- a/exercise_oop_composition_book_author/exercise_oop_composition_book_author.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exercise_oop_composition_book_author/src/Author.java b/exercise_oop_composition_book_author/src/Author.java
deleted file mode 100644
index 582797d..0000000
--- a/exercise_oop_composition_book_author/src/Author.java
+++ /dev/null
@@ -1,38 +0,0 @@
-public class Author {
- private String name;
- private String email;
- private String gender;
- private int age;
-
- public Author(String name, String email, String gender, int age) {
- this.name = name;
- this.email = email;
- this.gender = gender;
- this.age = age;
- }
-
- public String getName() {
- return name;
- }
-
- public String getEmail() {
- return email;
- }
-
- public String getGender() {
- return gender;
- }
-
- public int getAge() {
- return age;
- }
-
- public String toString() {
- return "Author{" +
- "name='" + name + '\'' +
- ", email='" + email + '\'' +
- ", gender='" + gender + '\'' +
- ", age=" + age +
- '}';
- }
-}
diff --git a/exercise_oop_composition_book_author/src/Book.java b/exercise_oop_composition_book_author/src/Book.java
deleted file mode 100644
index 8d3011a..0000000
--- a/exercise_oop_composition_book_author/src/Book.java
+++ /dev/null
@@ -1,39 +0,0 @@
-
-public class Book {
- private String name;
- private Author author;
- private double price;
- private int count;
-
- public Book(String name, Author author, double price, int count) {
- this.name = name;
- this.author = author;
- this.price = price;
- this.count = count;
- }
-
- public String getName() {
- return name;
- }
-
- public Author getAuthor() {
- return author;
- }
-
- public double getPrice() {
- return price;
- }
-
- public int count() {
- return count;
- }
-
- public String toString() {
- return "Book{" +
- "name='" + name + '\'' +
- ", author=" + author.getName() +
- ", price=" + price +
- ", count=" + count +
- '}';
- }
-}
diff --git a/exercise_oop_composition_book_author/src/Main.java b/exercise_oop_composition_book_author/src/Main.java
deleted file mode 100644
index 27938f4..0000000
--- a/exercise_oop_composition_book_author/src/Main.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Author author = new Author("shareprogramming.net", "nthanhhai2909@gmail.com", "male", 23);
- Book book = new Book("Java OOP", author, 10, 100);
- System.out.println(book.toString());
- }
-}
diff --git a/exercise_oop_composition_student_address/exercise_oop_composition_student_address.iml b/exercise_oop_composition_student_address/exercise_oop_composition_student_address.iml
deleted file mode 100644
index c90834f..0000000
--- a/exercise_oop_composition_student_address/exercise_oop_composition_student_address.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exercise_oop_composition_student_address/src/Address.java b/exercise_oop_composition_student_address/src/Address.java
deleted file mode 100644
index fe2232e..0000000
--- a/exercise_oop_composition_student_address/src/Address.java
+++ /dev/null
@@ -1,39 +0,0 @@
-
-public class Address {
- private String country;
- private String city;
- private String district;
- private String street;
-
- public Address(String country, String city, String district, String street) {
- this.country = country;
- this.city = city;
- this.district = district;
- this.street = street;
- }
-
- public String getCountry() {
- return country;
- }
-
- public String getCity() {
- return city;
- }
-
- public String getDistrict() {
- return district;
- }
-
- public String getStreet() {
- return street;
- }
-
- public String toString() {
- return "Address{" +
- "country='" + country + '\'' +
- ", city='" + city + '\'' +
- ", district='" + district + '\'' +
- ", street='" + street + '\'' +
- '}';
- }
-}
diff --git a/exercise_oop_composition_student_address/src/Main.java b/exercise_oop_composition_student_address/src/Main.java
deleted file mode 100644
index 3b72307..0000000
--- a/exercise_oop_composition_student_address/src/Main.java
+++ /dev/null
@@ -1,13 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Address address = new Address("VN", "HCM", "Q7", "428 LE VAN LUONG");
- Student student = new Student();
- student.setName("HGA");
- student.setAddress(address);
- student.setAge(23);
- student.setScore(5);
- System.out.println(student.toString());
- System.out.println("Xep loai: " + student.getRating());
- }
-}
diff --git a/exercise_oop_composition_student_address/src/Student.java b/exercise_oop_composition_student_address/src/Student.java
deleted file mode 100644
index b2059e3..0000000
--- a/exercise_oop_composition_student_address/src/Student.java
+++ /dev/null
@@ -1,58 +0,0 @@
-
-public class Student {
- private String name;
- private int age;
- private double score;
- private Address address;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public double getScore() {
- return score;
- }
-
- public void setScore(double score) {
- this.score = score;
- }
-
- public Address getAddress() {
- return address;
- }
-
- public void setAddress(Address address) {
- this.address = address;
- }
-
- public String getRating() {
- if (this.score < 5.0) {
- return "bad";
- } else if (this.score >= 5.0 && this.score < 8.0) {
- return "medium";
- } else {
- return "good";
- }
- }
-
- public String toString() {
- return "Student{" +
- "name='" + name + '\'' +
- ", age=" + age +
- ", score=" + score +
- ", address=" + address.toString() +
- '}';
- }
-}
diff --git a/exercise_oop_date/exercise_oop_date.iml b/exercise_oop_date/exercise_oop_date.iml
deleted file mode 100644
index c90834f..0000000
--- a/exercise_oop_date/exercise_oop_date.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exercise_oop_date/src/Date.java b/exercise_oop_date/src/Date.java
deleted file mode 100644
index 5098c1b..0000000
--- a/exercise_oop_date/src/Date.java
+++ /dev/null
@@ -1,56 +0,0 @@
-
-public class Date {
- private int day;
- private int month;
- private int year;
-
- public Date(int day, int month, int year) {
- this.day = day;
- this.month = month;
- this.year = year;
- }
-
- public int getDay() {
- return day;
- }
-
- public void setDay(int day) {
- this.day = day;
- }
-
- public int getMonth() {
- return month;
- }
-
- public void setMonth(int month) {
- this.month = month;
- }
-
- public int getYear() {
- return year;
- }
-
- public void setYear(int year) {
- this.year = year;
- }
-
- public String toString() {
- return "Date{" +
- "day=" + day +
- ", month=" + month +
- ", year=" + year +
- '}';
- }
-
- public boolean isLeapYear() {
- if (this.year % 400 == 0)
- return true;
-
- // Nếu số năm chia hết cho 4 và không chia hết cho 100,
- // đó không là 1 năm nhuận
- if (this.year % 4 == 0 && this.year % 100 != 0)
- return true;
-
- return false;
- }
-}
diff --git a/exercise_oop_date/src/Main.java b/exercise_oop_date/src/Main.java
deleted file mode 100644
index 84e4055..0000000
--- a/exercise_oop_date/src/Main.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Date date = new Date(12, 3, 2016);
- System.out.println(date.toString());
- System.out.println(date.isLeapYear());
- }
-}
diff --git a/exercise_oop_employee/exercise_oop_employee.iml b/exercise_oop_employee/exercise_oop_employee.iml
deleted file mode 100644
index c90834f..0000000
--- a/exercise_oop_employee/exercise_oop_employee.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exercise_oop_employee/src/Employee.java b/exercise_oop_employee/src/Employee.java
deleted file mode 100644
index 33e82b3..0000000
--- a/exercise_oop_employee/src/Employee.java
+++ /dev/null
@@ -1,51 +0,0 @@
-public class Employee {
- private int id;
- private String lastName;
- private String firstName;
- private int salary;
-
- public Employee(int id, String lastName, String firstName, int salary) {
- this.id = id;
- this.lastName = lastName;
- this.firstName = firstName;
- this.salary = salary;
- }
-
- public int getId() {
- return id;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public int getSalary() {
- return salary;
- }
-
- public void setSalary(int salary) {
- this.salary = salary;
- }
-
- public String getFullName() {
- return this.lastName + " " + this.firstName;
- }
-
- public int getAnnualSalary() {
- return this.salary * 12;
- }
-
- public int upToSalary(int percent) {
- return this.salary + (this.salary * percent)/100;
- }
-
- public String toString() {
- return this.getFullName() + " - " + "salary: " + this.salary;
- }
-}
-
-
diff --git a/exercise_oop_employee/src/Main.java b/exercise_oop_employee/src/Main.java
deleted file mode 100644
index 342c48f..0000000
--- a/exercise_oop_employee/src/Main.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Employee employee = new Employee(1, "Nguyen", "Sin", 10000000);
- System.out.println(employee.getFullName());
- System.out.println(employee.getAnnualSalary());
- System.out.println(employee.toString());
- System.out.println("Salary up to: " + employee.upToSalary(10));
- }
-}
diff --git a/exercise_oop_inheritance_circle_cylinder/exercise_oop_inheritance_circle_cylinder.iml b/exercise_oop_inheritance_circle_cylinder/exercise_oop_inheritance_circle_cylinder.iml
deleted file mode 100644
index c90834f..0000000
--- a/exercise_oop_inheritance_circle_cylinder/exercise_oop_inheritance_circle_cylinder.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exercise_oop_inheritance_circle_cylinder/src/Circle.java b/exercise_oop_inheritance_circle_cylinder/src/Circle.java
deleted file mode 100644
index bb6a581..0000000
--- a/exercise_oop_inheritance_circle_cylinder/src/Circle.java
+++ /dev/null
@@ -1,36 +0,0 @@
-public class Circle {
- private double radius;
- private String color;
-
- public Circle(double radius, String color) {
- this.radius = radius;
- this.color = color;
- }
-
- public double getRadius() {
- return radius;
- }
-
- public void setRadius(double radius) {
- this.radius = radius;
- }
-
- public String getColor() {
- return color;
- }
-
- public void setColor(String color) {
- this.color = color;
- }
-
- public double getArea() {
- return this.radius * this.radius * Math.PI;
- }
-
- public String toString() {
- return "Circle{" +
- "radius=" + radius +
- ", color='" + color + '\'' +
- '}';
- }
-}
diff --git a/exercise_oop_inheritance_circle_cylinder/src/Cylinder.java b/exercise_oop_inheritance_circle_cylinder/src/Cylinder.java
deleted file mode 100644
index 5cda15a..0000000
--- a/exercise_oop_inheritance_circle_cylinder/src/Cylinder.java
+++ /dev/null
@@ -1,21 +0,0 @@
-public class Cylinder extends Circle {
- private double heigth;
-
- public Cylinder(double radius, String color, double heigth) {
- super(radius, color);
- this.heigth = heigth;
- }
-
- public double getHeigth() {
- return heigth;
- }
-
- public void setHeigth(double heigth) {
- this.heigth = heigth;
- }
-
- public double getVolumer() {
- return super.getArea() * this.heigth;
- }
-
-}
diff --git a/exercise_oop_inheritance_circle_cylinder/src/Main.java b/exercise_oop_inheritance_circle_cylinder/src/Main.java
deleted file mode 100644
index 51647e6..0000000
--- a/exercise_oop_inheritance_circle_cylinder/src/Main.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Circle cylinder = new Cylinder(2.4, "red", 10);
- System.out.println("Area: " + cylinder.getArea());
- System.out.println("Volume: " + ((Cylinder) cylinder).getVolumer());
- }
-}
diff --git a/exercise_oop_inheritance_person_student_staff/exercise_oop_inheritance_person_student_staff.iml b/exercise_oop_inheritance_person_student_staff/exercise_oop_inheritance_person_student_staff.iml
deleted file mode 100644
index c90834f..0000000
--- a/exercise_oop_inheritance_person_student_staff/exercise_oop_inheritance_person_student_staff.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exercise_oop_inheritance_person_student_staff/src/Main.java b/exercise_oop_inheritance_person_student_staff/src/Main.java
deleted file mode 100644
index 88e73ab..0000000
--- a/exercise_oop_inheritance_person_student_staff/src/Main.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Person student = new Student("H", "DN", "CHINH QUY", 3, 6.7);
- Person staff = new Staff("D", "BT", "KHTN", 12.5);
- System.out.println(((Student) student).getRating());
- System.out.println(((Staff) staff).upToSalary(40));
-
- }
-}
diff --git a/exercise_oop_inheritance_person_student_staff/src/Person.java b/exercise_oop_inheritance_person_student_staff/src/Person.java
deleted file mode 100644
index f5176ef..0000000
--- a/exercise_oop_inheritance_person_student_staff/src/Person.java
+++ /dev/null
@@ -1,17 +0,0 @@
-public class Person {
- private String name;
- private String address;
-
- public Person(String name, String address) {
- this.name = name;
- this.address = address;
- }
-
- public String getAddress() {
- return address;
- }
-
- public String getName() {
- return name;
- }
-}
diff --git a/exercise_oop_inheritance_person_student_staff/src/Staff.java b/exercise_oop_inheritance_person_student_staff/src/Staff.java
deleted file mode 100644
index e1d1a9b..0000000
--- a/exercise_oop_inheritance_person_student_staff/src/Staff.java
+++ /dev/null
@@ -1,31 +0,0 @@
-public class Staff extends Person {
-
- private String school;
- private double salary;
-
- public Staff(String name, String address, String school, double salary) {
- super(name, address);
- this.school = school;
- this.salary = salary;
- }
-
- public String getSchool() {
- return school;
- }
-
- public void setSchool(String school) {
- this.school = school;
- }
-
- public double getSalary() {
- return salary;
- }
-
- public void setSalary(double salary) {
- this.salary = salary;
- }
-
- public double upToSalary(int percent) {
- return this.salary + (this.salary * percent) / 100;
- }
-}
diff --git a/exercise_oop_inheritance_person_student_staff/src/Student.java b/exercise_oop_inheritance_person_student_staff/src/Student.java
deleted file mode 100644
index 1a125de..0000000
--- a/exercise_oop_inheritance_person_student_staff/src/Student.java
+++ /dev/null
@@ -1,47 +0,0 @@
-public class Student extends Person{
- private String program;
- private int year;
- private double score;
-
- public Student(String name, String address, String program, int year, double score) {
- super(name, address);
- this.program = program;
- this.year = year;
- this.score = score;
- }
-
- public String getProgram() {
- return program;
- }
-
- public void setProgram(String program) {
- this.program = program;
- }
-
- public int getYear() {
- return year;
- }
-
- public void setYear(int year) {
- this.year = year;
- }
-
- public double getScore() {
- return score;
- }
-
- public void setScore(double score) {
- this.score = score;
- }
-
- public String getRating() {
- if (this.score < 5) {
- return "bad";
- } else if (this.score >= 5 && this.score <8) {
- return "medium";
- } else {
- return "good";
- }
- }
-
-}
diff --git a/exercise_oop_polymorphism_interface_moveable/exercise_oop_polymorphism_interface_moveable.iml b/exercise_oop_polymorphism_interface_moveable/exercise_oop_polymorphism_interface_moveable.iml
deleted file mode 100644
index c90834f..0000000
--- a/exercise_oop_polymorphism_interface_moveable/exercise_oop_polymorphism_interface_moveable.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exercise_oop_polymorphism_interface_moveable/src/Main.java b/exercise_oop_polymorphism_interface_moveable/src/Main.java
deleted file mode 100644
index e07f4eb..0000000
--- a/exercise_oop_polymorphism_interface_moveable/src/Main.java
+++ /dev/null
@@ -1,16 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- MoveablePoint moveablePoint = new MoveablePoint(10, 5, 1,1);
- MoveableCircle moveableCircle = new MoveableCircle(moveablePoint, 4);
- System.out.println(moveableCircle.toString());
- moveableCircle.moveRight();
- System.out.println(moveableCircle.toString());
- moveableCircle.moveUp();
- System.out.println(moveableCircle.toString());
- moveableCircle.moveLeft();
- System.out.println(moveableCircle.toString());
- moveableCircle.moveDown();
- System.out.println(moveableCircle.toString());
- }
-}
diff --git a/exercise_oop_polymorphism_interface_moveable/src/Moveable.java b/exercise_oop_polymorphism_interface_moveable/src/Moveable.java
deleted file mode 100644
index 9cda3d9..0000000
--- a/exercise_oop_polymorphism_interface_moveable/src/Moveable.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public interface Moveable {
- void moveUp();
- void moveDown();
- void moveLeft();
- void moveRight();
-}
diff --git a/exercise_oop_polymorphism_interface_moveable/src/MoveableCircle.java b/exercise_oop_polymorphism_interface_moveable/src/MoveableCircle.java
deleted file mode 100644
index 037c7db..0000000
--- a/exercise_oop_polymorphism_interface_moveable/src/MoveableCircle.java
+++ /dev/null
@@ -1,35 +0,0 @@
-public class MoveableCircle implements Moveable{
-
- private MoveablePoint center;
- private double radius;
-
- public MoveableCircle(MoveablePoint center, double radius) {
- this.center = center;
- this.radius = radius;
- }
-
- @Override
- public void moveUp() {
- this.center.setX(this.center.getX() + this.center.getxSpeed());
- }
-
- @Override
- public void moveDown() {
- this.center.setX(this.center.getX() - this.center.getxSpeed());
- }
-
- @Override
- public void moveLeft() {
- this.center.setY(this.center.getY() - this.center.getySpeed());
- }
-
- @Override
- public void moveRight() {
- this.center.setY(this.center.getY() + this.center.getySpeed());
- }
-
- @Override
- public String toString() {
- return "Center: " + "(" + this.center.getX() + ", "+ this.center.getY() + ")";
- }
-}
diff --git a/exercise_oop_polymorphism_interface_moveable/src/MoveablePoint.java b/exercise_oop_polymorphism_interface_moveable/src/MoveablePoint.java
deleted file mode 100644
index 8543190..0000000
--- a/exercise_oop_polymorphism_interface_moveable/src/MoveablePoint.java
+++ /dev/null
@@ -1,76 +0,0 @@
-public class MoveablePoint implements Moveable {
- private int x;
- private int y;
- private int xSpeed;
- private int ySpeed;
-
- public MoveablePoint(int x, int y, int xSpeed, int ySpeed) {
- this.x = x;
- this.y = y;
- this.xSpeed = xSpeed;
- this.ySpeed = ySpeed;
- }
-
- @Override
- public void moveUp() {
- this.x += this.xSpeed;
-
- }
-
- @Override
- public void moveDown() {
- this.x -= this.xSpeed;
- }
-
- @Override
- public void moveLeft() {
- this.y -= this.ySpeed;
- }
-
- @Override
- public void moveRight() {
- this.y += this.ySpeed;
- }
-
- public int getX() {
- return x;
- }
-
- public void setX(int x) {
- this.x = x;
- }
-
- public int getY() {
- return y;
- }
-
- public void setY(int y) {
- this.y = y;
- }
-
- public int getxSpeed() {
- return xSpeed;
- }
-
- public void setxSpeed(int xSpeed) {
- this.xSpeed = xSpeed;
- }
-
- public int getySpeed() {
- return ySpeed;
- }
-
- public void setySpeed(int ySpeed) {
- this.ySpeed = ySpeed;
- }
-
- @Override
- public String toString() {
- return "MoveablePoint{" +
- "x=" + x +
- ", y=" + y +
- ", xSpeed=" + xSpeed +
- ", ySpeed=" + ySpeed +
- '}';
- }
-}
diff --git a/exercise_polymorphism/Circle.java b/exercise_polymorphism/Circle.java
deleted file mode 100644
index 5d0e6a4..0000000
--- a/exercise_polymorphism/Circle.java
+++ /dev/null
@@ -1,38 +0,0 @@
-public class Circle extends Shape {
- private double radius;
-
- public Circle() {
- }
-
- public Circle(double radius) {
- this.radius = radius;
- }
-
- public Circle(String color, boolean filled, double radius) {
- super(color, filled);
- this.radius = radius;
- }
-
- public double getRadius() {
- return radius;
- }
-
- public void setRadius(double radius) {
- this.radius = radius;
- }
-
- @Override
- public double getArea() {
- return Math.PI * this.radius * this.radius;
- }
-
- @Override
- public double getPerimeter() {
- return this.radius * 2 * Math.PI;
- }
-
- @Override
- public String toString() {
- return this.radius + " - " + this.color + " - " + this.filled;
- }
-}
diff --git a/exercise_polymorphism/Main.java b/exercise_polymorphism/Main.java
deleted file mode 100644
index 722548b..0000000
--- a/exercise_polymorphism/Main.java
+++ /dev/null
@@ -1,53 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- Shape s1 = new Circle("RED", true, 5.5);
- System.out.println(s1);
- System.out.println(s1.getArea()); // which version?
- System.out.println(s1.getPerimeter()); // which version?
- System.out.println(s1.getColor());
- System.out.println(s1.isFilled());
- System.out.println(((Circle) s1).getRadius());
-
- Circle c1 = (Circle)s1;
- System.out.println(c1);
- System.out.println(c1.getArea());
- System.out.println(c1.getPerimeter());
- System.out.println(c1.getColor());
- System.out.println(c1.isFilled());
- System.out.println(c1.getRadius());
-
- Shape s3 = new Rectangle("RED", false, 4.5, 7.5);
- System.out.println(s3);
- System.out.println(s3.getArea());
- System.out.println(s3.getPerimeter());
- System.out.println(s3.getColor());
- System.out.println(((Rectangle) s3).getLength());
-
- Rectangle r1 = (Rectangle)s3;
- System.out.println(r1);
- System.out.println(r1.getArea());
- System.out.println(r1.getColor());
- System.out.println(r1.getLength());
-
- Shape s4 = new Square(6.6);
- System.out.println(s4);
- System.out.println(s4.getArea());
- System.out.println(s4.getColor());
- System.out.println(((Square) s4).getWidth());
-
- Rectangle r2 = (Rectangle)s4;
- System.out.println(r2);
- System.out.println(r2.getArea());
- System.out.println(r2.getColor());
- System.out.println(r2.getWidth());
- System.out.println(r2.getLength());
-
- Square sq1 = (Square)r2;
- System.out.println(sq1);
- System.out.println(sq1.getArea());
- System.out.println(sq1.getColor());
- System.out.println(sq1.getWidth());
- System.out.println(sq1.getLength());
- }
-}
diff --git a/exercise_polymorphism/Rectangle.java b/exercise_polymorphism/Rectangle.java
deleted file mode 100644
index 1c3ddaa..0000000
--- a/exercise_polymorphism/Rectangle.java
+++ /dev/null
@@ -1,50 +0,0 @@
-public class Rectangle extends Shape{
-
- protected double width;
- protected double length;
-
- public Rectangle() {
- }
-
- public Rectangle(double width, double length) {
- this.width = width;
- this.length = length;
- }
-
- public Rectangle(String color, boolean filled, double width, double length) {
- super(color, filled);
- this.width = width;
- this.length = length;
- }
-
- public double getWidth() {
- return width;
- }
-
- public void setWidth(double width) {
- this.width = width;
- }
-
- public double getLength() {
- return length;
- }
-
- public void setLength(double length) {
- this.length = length;
- }
-
- @Override
- public double getArea() {
- return this.width * this.length;
- }
-
- @Override
- public double getPerimeter() {
- return this.width + this.length;
- }
-
- @Override
- public String toString() {
- return this.width + " - " + this.length + " - " + this.color + " - " + this.filled;
- }
-}
diff --git a/exercise_polymorphism/Shape.java b/exercise_polymorphism/Shape.java
deleted file mode 100644
index 6e5e840..0000000
--- a/exercise_polymorphism/Shape.java
+++ /dev/null
@@ -1,32 +0,0 @@
-public abstract class Shape {
- protected String color;
- protected boolean filled;
-
- public Shape() {}
-
- public Shape(String color, boolean filled) {
- this.color = color;
- this.filled = filled;
- }
-
- public String getColor() {
- return color;
- }
-
- public void setColor(String color) {
- this.color = color;
- }
-
- public boolean isFilled() {
- return filled;
- }
-
- public void setFilled(boolean filled) {
- this.filled = filled;
- }
-
- public abstract double getArea();
- public abstract double getPerimeter();
- public abstract String toString();
-
-}
diff --git a/exercise_polymorphism/Square.java b/exercise_polymorphism/Square.java
deleted file mode 100644
index 39a15e9..0000000
--- a/exercise_polymorphism/Square.java
+++ /dev/null
@@ -1,12 +0,0 @@
-public class Square extends Rectangle {
- public Square() {
- }
-
- public Square(double side) {
- super(side, side);
- }
-
- public Square(String color, boolean filled, double side) {
- super(color, filled, side, side);
- }
-}
diff --git a/exerciseoop_class-object_cricle/exerciseoop_class-object_cricle.iml b/exerciseoop_class-object_cricle/exerciseoop_class-object_cricle.iml
deleted file mode 100644
index c90834f..0000000
--- a/exerciseoop_class-object_cricle/exerciseoop_class-object_cricle.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exerciseoop_class-object_cricle/src/com/company/Circle.java b/exerciseoop_class-object_cricle/src/com/company/Circle.java
deleted file mode 100644
index c83d198..0000000
--- a/exerciseoop_class-object_cricle/src/com/company/Circle.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.company;
-
-public class Circle {
- private double radius;
- private String color;
-
- public Circle() {
- this.radius = 1.0;
- this.color = "red";
- }
-
- public Circle(double radius) {
- this.radius = radius;
- this.color = "red";
- }
-
- public Circle(double radius, String color) {
- this.radius = radius;
- this.color = color;
- }
-
- public double getRadius() {
- return radius;
- }
-
- public void setRadius(double radius) {
- this.radius = radius;
- }
-
- public String getColor() {
- return color;
- }
-
- public void setColor(String color) {
- this.color = color;
- }
-
- public double getArea() {
- return this.radius * this.radius * Math.PI;
- }
-
- public String toString() {
- return "Radius: " + this.radius + " - Color: " + this.color;
- }
-}
diff --git a/exerciseoop_class-object_cricle/src/com/company/Main.java b/exerciseoop_class-object_cricle/src/com/company/Main.java
deleted file mode 100644
index 304d1d5..0000000
--- a/exerciseoop_class-object_cricle/src/com/company/Main.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.company;
-
-public class Main {
-
- public static void main(String[] args) {
- // Test default constructor
- Circle circle1 = new Circle();
- display(circle1);
-
- // Test constructor has 1 parameter radius
- Circle circle2 = new Circle(2.0);
- display(circle2);
-
- // Test constructor has 2 parameter radius, color
- Circle circle3 = new Circle(2.0, "blue");
- display(circle3);
-
- // Test getter setter
- Circle circle4 = new Circle();
- circle4.setColor("Green");
- circle4.setRadius(3.0);
- display(circle4);
-
-
-
- }
-
- public static void display(Circle circle) {
- System.out.println(circle.toString());
- System.out.println("Area: " + circle.getArea());
- System.out.println();
- }
-}
\ No newline at end of file
diff --git a/exerciseoop_class-object_rectangle/exerciseoop_class-object_rectangle.iml b/exerciseoop_class-object_rectangle/exerciseoop_class-object_rectangle.iml
deleted file mode 100644
index c90834f..0000000
--- a/exerciseoop_class-object_rectangle/exerciseoop_class-object_rectangle.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/exerciseoop_class-object_rectangle/src/com/company/Main.java b/exerciseoop_class-object_rectangle/src/com/company/Main.java
deleted file mode 100644
index 2765487..0000000
--- a/exerciseoop_class-object_rectangle/src/com/company/Main.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.company;
-
-public class Main {
-
- public static void main(String[] args) {
- Rectangle rectangle1 = new Rectangle();
- rectangle1.setLength(10);
- rectangle1.setWidth(13);
- System.out.println(rectangle1.toString());
- System.out.println("Area: " + rectangle1.getArea());
- }
-}
diff --git a/exerciseoop_class-object_rectangle/src/com/company/Rectangle.java b/exerciseoop_class-object_rectangle/src/com/company/Rectangle.java
deleted file mode 100644
index 176f3d1..0000000
--- a/exerciseoop_class-object_rectangle/src/com/company/Rectangle.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.company;
-
-public class Rectangle {
- private int length;
- private int width;
-
- public Rectangle() {}
-
- public Rectangle(int length, int width) {
- this.length = length;
- this.width = width;
- }
-
- public int getLength() {
- return length;
- }
-
- public void setLength(int length) {
- this.length = length;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getArea() {
- return this.length * this.width;
- }
-
- public String toString() {
- return "Length: " + this.length + " - Width: " + this.width;
- }
-}
diff --git a/oop-b14/oop-b14.iml b/oop-b14/oop-b14.iml
deleted file mode 100644
index e7b98ac..0000000
--- a/oop-b14/oop-b14.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/oop-b14/src/Main.java b/oop-b14/src/Main.java
deleted file mode 100644
index c0830d8..0000000
--- a/oop-b14/src/Main.java
+++ /dev/null
@@ -1,33 +0,0 @@
-import entity.GoodStudent;
-import entity.NormalStudent;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class Main {
- public static void main(String[] args) {
- // DEMO cho câu 14 yêu cầu 3
- List goodStudent = Arrays.asList(
- new GoodStudent("Nguyễn Văn D","", "", "", "", "", 7.3f, ""),
- new GoodStudent("Nguyễn Văn B","", "", "", "", "", 7.2f, ""),
- new GoodStudent("Nguyễn Văn A", "", "", "", "", "", 7.2f, ""),
- new GoodStudent("Nguyễn Văn C","", "", "", "", "", 7.3f, "")
- );
- System.out.println("abc");
- List lgs = getSortedGoodStudentList(goodStudent).subList(0, 2);
- lgs.forEach(System.out::println);
- }
-
-
- public static List getSortedGoodStudentList(List playerList) {
- return playerList.stream().sorted(Comparator.comparing(GoodStudent::getGpa).reversed()
- .thenComparing(GoodStudent::getLastName)).collect(Collectors.toList());
- }
-
- public static List getSortedNormalStudentList(List playerList) {
- return playerList.stream().sorted(Comparator.comparing(NormalStudent::getEnglishScore).reversed()
- .thenComparing(NormalStudent::getLastName)).collect(Collectors.toList());
- }
-}
diff --git a/oop-b14/src/entity/GoodStudent.java b/oop-b14/src/entity/GoodStudent.java
deleted file mode 100644
index dc32c2c..0000000
--- a/oop-b14/src/entity/GoodStudent.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package entity;
-
-public class GoodStudent extends Student {
- Float gpa;
- String bestRewardName;
-
-
- public GoodStudent(String fullName, String dob, String gender, String phoneNumber, String universityName, String gradeLevel, Float gpa, String bestRewardName) {
- super(fullName, dob, gender, phoneNumber, universityName, gradeLevel);
- this.gpa = gpa;
- this.bestRewardName = bestRewardName;
- }
-
- public Float getGpa() {
- return gpa;
- }
-
-}
diff --git a/oop-b14/src/entity/NormalStudent.java b/oop-b14/src/entity/NormalStudent.java
deleted file mode 100644
index ccfd98c..0000000
--- a/oop-b14/src/entity/NormalStudent.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package entity;
-
-public class NormalStudent extends Student{
- Integer englishScore;
- Float entryTestScore;
-
- public NormalStudent(String fullName, String dob, String gender, String phoneNumber, String universityName, String gradeLevel, Integer englishScore, Float entryTestScore) {
- super(fullName, dob, gender, phoneNumber, universityName, gradeLevel);
- this.englishScore = englishScore;
- this.entryTestScore = entryTestScore;
- }
-
- public Integer getEnglishScore() {
- return englishScore;
- }
-}
diff --git a/oop-b14/src/entity/Student.java b/oop-b14/src/entity/Student.java
deleted file mode 100644
index ce00b40..0000000
--- a/oop-b14/src/entity/Student.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package entity;
-
-public class Student {
- String fullName;
- String dob;
- String gender;
- String phoneNumber;
- String universityName;
- String gradeLevel;
-
- public Student(String fullName, String dob, String gender, String phoneNumber, String universityName, String gradeLevel) {
- this.fullName = fullName;
- this.dob = dob;
- this.gender = gender;
- this.phoneNumber = phoneNumber;
- this.universityName = universityName;
- this.gradeLevel = gradeLevel;
- }
-
- public String getLastName() {
- String[] nameSplit = fullName.split(" ");
- return nameSplit[nameSplit.length - 1];
- }
-}
diff --git a/oop-shareprogramming.iml b/oop-shareprogramming.iml
deleted file mode 100644
index c6f833d..0000000
--- a/oop-shareprogramming.iml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/oop_employee_management/.idea/.gitignore b/oop_employee_management/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/oop_employee_management/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/oop_employee_management/.idea/misc.xml b/oop_employee_management/.idea/misc.xml
deleted file mode 100644
index 0548357..0000000
--- a/oop_employee_management/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/oop_employee_management/.idea/modules.xml b/oop_employee_management/.idea/modules.xml
deleted file mode 100644
index 76c0135..0000000
--- a/oop_employee_management/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/oop_employee_management/.idea/uiDesigner.xml b/oop_employee_management/.idea/uiDesigner.xml
deleted file mode 100644
index e96534f..0000000
--- a/oop_employee_management/.idea/uiDesigner.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
-
\ No newline at end of file
diff --git a/oop_employee_management/.idea/vcs.xml b/oop_employee_management/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/oop_employee_management/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/oop_employee_management/README.md b/oop_employee_management/README.md
deleted file mode 100644
index c203d41..0000000
--- a/oop_employee_management/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# oop_employee_management
-
-
-
-## Getting started
-
-Bản code prototype cho bài 13 trong bộ bài tập tổng hợp tại [Deft blog](https://shareprogramming.net/tong-hop-bai-tap-lap-trinh-huong-doi-tuong-trong-java/)
-
-Các bạn có thể dựa vào đây, để lấy ý tưởng và triển khai bài hoàn chỉnh.
-
-
diff --git a/oop_employee_management/oop_b13.iml b/oop_employee_management/oop_b13.iml
deleted file mode 100644
index c90834f..0000000
--- a/oop_employee_management/oop_b13.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/oop_employee_management/oop_employee_management.iml b/oop_employee_management/oop_employee_management.iml
deleted file mode 100644
index c90834f..0000000
--- a/oop_employee_management/oop_employee_management.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/oop_employee_management/out/production/oop_b13/Main.class b/oop_employee_management/out/production/oop_b13/Main.class
deleted file mode 100644
index 725e64c..0000000
Binary files a/oop_employee_management/out/production/oop_b13/Main.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/entity/Certificate.class b/oop_employee_management/out/production/oop_b13/entity/Certificate.class
deleted file mode 100644
index e33d657..0000000
Binary files a/oop_employee_management/out/production/oop_b13/entity/Certificate.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/entity/Employee.class b/oop_employee_management/out/production/oop_b13/entity/Employee.class
deleted file mode 100644
index f1d5b0b..0000000
Binary files a/oop_employee_management/out/production/oop_b13/entity/Employee.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/entity/Experience.class b/oop_employee_management/out/production/oop_b13/entity/Experience.class
deleted file mode 100644
index 5a148a3..0000000
Binary files a/oop_employee_management/out/production/oop_b13/entity/Experience.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/entity/Fresher.class b/oop_employee_management/out/production/oop_b13/entity/Fresher.class
deleted file mode 100644
index cfe7401..0000000
Binary files a/oop_employee_management/out/production/oop_b13/entity/Fresher.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/entity/Intern.class b/oop_employee_management/out/production/oop_b13/entity/Intern.class
deleted file mode 100644
index d5c6bf6..0000000
Binary files a/oop_employee_management/out/production/oop_b13/entity/Intern.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/exception/BirthDayException.class b/oop_employee_management/out/production/oop_b13/exception/BirthDayException.class
deleted file mode 100644
index 123bac5..0000000
Binary files a/oop_employee_management/out/production/oop_b13/exception/BirthDayException.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/exception/EmailException.class b/oop_employee_management/out/production/oop_b13/exception/EmailException.class
deleted file mode 100644
index 184d350..0000000
Binary files a/oop_employee_management/out/production/oop_b13/exception/EmailException.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/exception/FullNameException.class b/oop_employee_management/out/production/oop_b13/exception/FullNameException.class
deleted file mode 100644
index 9c14fe4..0000000
Binary files a/oop_employee_management/out/production/oop_b13/exception/FullNameException.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/exception/PhoneException.class b/oop_employee_management/out/production/oop_b13/exception/PhoneException.class
deleted file mode 100644
index aa55fb9..0000000
Binary files a/oop_employee_management/out/production/oop_b13/exception/PhoneException.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/service/EmployeeManager.class b/oop_employee_management/out/production/oop_b13/service/EmployeeManager.class
deleted file mode 100644
index f5d46a0..0000000
Binary files a/oop_employee_management/out/production/oop_b13/service/EmployeeManager.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/ui/ScannerFactory.class b/oop_employee_management/out/production/oop_b13/ui/ScannerFactory.class
deleted file mode 100644
index 79a40d1..0000000
Binary files a/oop_employee_management/out/production/oop_b13/ui/ScannerFactory.class and /dev/null differ
diff --git a/oop_employee_management/out/production/oop_b13/ui/UIManager.class b/oop_employee_management/out/production/oop_b13/ui/UIManager.class
deleted file mode 100644
index d9bd529..0000000
Binary files a/oop_employee_management/out/production/oop_b13/ui/UIManager.class and /dev/null differ
diff --git a/oop_employee_management/src/Main.java b/oop_employee_management/src/Main.java
deleted file mode 100644
index 618e1f5..0000000
--- a/oop_employee_management/src/Main.java
+++ /dev/null
@@ -1,29 +0,0 @@
-import ui.ScannerFactory;
-import ui.UIManager;
-
-import java.util.Scanner;
-
-public class Main {
- public static void main(String[] args) {
- UIManager uiManager = new UIManager();
- Scanner scanner = ScannerFactory.getScanner();
- Integer ch = scanner.nextInt();
- while (true) {
- System.out.println("Application");
- System.out.println("Enter 1: To insert ");
- System.out.println("Enter 2: To search: ");
- // TODO HERE
- System.out.println("Enter 4: To exit:");
- switch (ch) {
- case 1: {
- // input 0 => insert Experience
- // input 1 => insert Fresher
- // input 2 => insert Intern
- int type = scanner.nextInt();
- uiManager.insert(type);
- }
- // TODO HERE
- }
- }
- }
-}
diff --git a/oop_employee_management/src/entity/Certificate.java b/oop_employee_management/src/entity/Certificate.java
deleted file mode 100644
index 359db6a..0000000
--- a/oop_employee_management/src/entity/Certificate.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package entity;
-
-import java.time.LocalDate;
-
-public class Certificate {
- private String id;
- private String name;
- private String rank;
- private LocalDate date;
-
- public Certificate() {
- }
-
- public Certificate(String id, String name, String rank, LocalDate date) {
- this.id = id;
- this.name = name;
- this.rank = rank;
- this.date = date;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getRank() {
- return rank;
- }
-
- public void setRank(String rank) {
- this.rank = rank;
- }
-
- public LocalDate getDate() {
- return date;
- }
-
- public void setDate(LocalDate date) {
- this.date = date;
- }
-}
diff --git a/oop_employee_management/src/entity/Employee.java b/oop_employee_management/src/entity/Employee.java
deleted file mode 100644
index 8873ec4..0000000
--- a/oop_employee_management/src/entity/Employee.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package entity;
-
-import java.time.LocalDate;
-import java.util.List;
-
-public abstract class Employee {
- public static long count = 0;
- protected String id;
- protected String fullName;
- protected LocalDate birthday;
- protected String phone;
- protected String email;
- protected List certificates;
-
- public Employee() {}
-
- public Employee(String id, String fullName, LocalDate birthday, String phone, String email, List certificates) {
- this.id = id;
- this.fullName = fullName;
- this.birthday = birthday;
- this.phone = phone;
- this.email = email;
- this.certificates = certificates;
- }
-
- public abstract void showInformation();
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getFullName() {
- return fullName;
- }
-
- public void setFullName(String fullName) {
- this.fullName = fullName;
- }
-
- public LocalDate getBirthday() {
- return birthday;
- }
-
- public void setBirthday(LocalDate birthday) {
- this.birthday = birthday;
- }
-
- public String getPhone() {
- return phone;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public List getCertificates() {
- return certificates;
- }
-
- public void setCertificates(List certificates) {
- this.certificates = certificates;
- }
-}
diff --git a/oop_employee_management/src/entity/Experience.java b/oop_employee_management/src/entity/Experience.java
deleted file mode 100644
index 005dfe7..0000000
--- a/oop_employee_management/src/entity/Experience.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package entity;
-
-import java.time.LocalDate;
-import java.util.List;
-
-public class Experience extends Employee {
- private int yearOfExperience;
- private String proSkill;
-
- public Experience() {
- }
-
- public Experience(int yearOfExperience, String proSkill) {
- this.yearOfExperience = yearOfExperience;
- this.proSkill = proSkill;
- }
-
- public Experience(String id, String fullName, LocalDate birthday, String phone, String email, List certificates, int yearOfExperience, String proSkill) {
- super(id, fullName, birthday, phone, email, certificates);
- this.yearOfExperience = yearOfExperience;
- this.proSkill = proSkill;
- }
-
- @Override
- public void showInformation() {
- System.out.println(this);
- }
-
- public int getYearOfExperience() {
- return yearOfExperience;
- }
-
- public void setYearOfExperience(int yearOfExperience) {
- this.yearOfExperience = yearOfExperience;
- }
-
- public String getProSkill() {
- return proSkill;
- }
-
- public void setProSkill(String proSkill) {
- this.proSkill = proSkill;
- }
-
- @Override
- public String toString() {
- return "Experience{" +
- "id='" + id + '\'' +
- ", fullName='" + fullName + '\'' +
- ", birthday=" + birthday +
- ", phone='" + phone + '\'' +
- ", email='" + email + '\'' +
- ", yearOfExperience=" + yearOfExperience +
- ", proSkill='" + proSkill + '\'' +
- '}';
- }
-}
diff --git a/oop_employee_management/src/entity/Fresher.java b/oop_employee_management/src/entity/Fresher.java
deleted file mode 100644
index 993a6a6..0000000
--- a/oop_employee_management/src/entity/Fresher.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package entity;
-
-import java.time.LocalDate;
-import java.util.List;
-
-public class Fresher extends Employee {
-
- private LocalDate graduationDate;
- private String graduationRank;
- private String universityName;
-
- public Fresher() {
- }
-
- public Fresher(LocalDate graduationDate, String graduationRank, String universityName) {
- this.graduationDate = graduationDate;
- this.graduationRank = graduationRank;
- this.universityName = universityName;
- }
-
- public Fresher(String id, String fullName, LocalDate birthday, String phone, String email, List certificates, LocalDate graduationDate, String graduationRank, String universityName) {
- super(id, fullName, birthday, phone, email, certificates);
- this.graduationDate = graduationDate;
- this.graduationRank = graduationRank;
- this.universityName = universityName;
- }
-
- @Override
- public void showInformation() {
- System.out.println(this);
- }
-
- public LocalDate getGraduationDate() {
- return graduationDate;
- }
-
- public void setGraduationDate(LocalDate graduationDate) {
- this.graduationDate = graduationDate;
- }
-
- public String getGraduationRank() {
- return graduationRank;
- }
-
- public void setGraduationRank(String graduationRank) {
- this.graduationRank = graduationRank;
- }
-
- public String getEducation() {
- return universityName;
- }
-
- public void setEducation(String education) {
- this.universityName = education;
- }
-
- @Override
- public String toString() {
- return "Fresher{" +
- "id='" + id + '\'' +
- ", fullName='" + fullName + '\'' +
- ", birthday=" + birthday +
- ", phone='" + phone + '\'' +
- ", email='" + email + '\'' +
- ", graduationDate=" + graduationDate +
- ", graduationRank='" + graduationRank + '\'' +
- ", universityName='" + universityName + '\'' +
- '}';
- }
-}
diff --git a/oop_employee_management/src/entity/Intern.java b/oop_employee_management/src/entity/Intern.java
deleted file mode 100644
index 61d19b5..0000000
--- a/oop_employee_management/src/entity/Intern.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package entity;
-
-import java.time.LocalDate;
-import java.util.List;
-
-public class Intern extends Employee {
- private String major;
- private int semester;
- private String universityName;
-
- public Intern() {
- }
-
- public Intern(String major, int semester, String universityName) {
- this.major = major;
- this.semester = semester;
- this.universityName = universityName;
- }
-
- public Intern(String id, String fullName, LocalDate birthday, String phone, String email, List certificates, String major, int semester, String universityName) {
- super(id, fullName, birthday, phone, email, certificates);
- this.major = major;
- this.semester = semester;
- this.universityName = universityName;
- }
-
- @Override
- public void showInformation() {
- System.out.println(this);
- }
-
- public String getMajor() {
- return major;
- }
-
- public void setMajor(String major) {
- this.major = major;
- }
-
- public int getSemester() {
- return semester;
- }
-
- public void setSemester(int semester) {
- this.semester = semester;
- }
-
- public String getUniversityName() {
- return universityName;
- }
-
- public void setUniversityName(String universityName) {
- this.universityName = universityName;
- }
-
- @Override
- public String toString() {
- return "Intern{" +
- "id='" + id + '\'' +
- ", fullName='" + fullName + '\'' +
- ", birthday=" + birthday +
- ", phone='" + phone + '\'' +
- ", email='" + email + '\'' +
- ", major='" + major + '\'' +
- ", semester=" + semester +
- ", universityName='" + universityName + '\'' +
- '}';
- }
-}
diff --git a/oop_employee_management/src/exception/BirthDayException.java b/oop_employee_management/src/exception/BirthDayException.java
deleted file mode 100644
index cdeb54f..0000000
--- a/oop_employee_management/src/exception/BirthDayException.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package exception;
-
-public class BirthDayException extends Exception {
- public BirthDayException(String message) {
- super(message);
- }
-}
diff --git a/oop_employee_management/src/exception/EmailException.java b/oop_employee_management/src/exception/EmailException.java
deleted file mode 100644
index 24688f7..0000000
--- a/oop_employee_management/src/exception/EmailException.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package exception;
-
-public class EmailException extends Exception {
-}
diff --git a/oop_employee_management/src/exception/FullNameException.java b/oop_employee_management/src/exception/FullNameException.java
deleted file mode 100644
index c9a6977..0000000
--- a/oop_employee_management/src/exception/FullNameException.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package exception;
-
-public class FullNameException extends Exception {
-
- public FullNameException(String message) {
- super(message);
- }
-}
diff --git a/oop_employee_management/src/exception/PhoneException.java b/oop_employee_management/src/exception/PhoneException.java
deleted file mode 100644
index c46a667..0000000
--- a/oop_employee_management/src/exception/PhoneException.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package exception;
-
-public class PhoneException extends Exception {
-
- public PhoneException(String message) {
- super(message);
- }
-}
diff --git a/oop_employee_management/src/service/EmployeeManager.java b/oop_employee_management/src/service/EmployeeManager.java
deleted file mode 100644
index 9a88348..0000000
--- a/oop_employee_management/src/service/EmployeeManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package service;
-
-import entity.Employee;
-import entity.Experience;
-import entity.Fresher;
-import entity.Intern;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class EmployeeManager {
-
- private List employees;
-
- public EmployeeManager() {
- this.employees = new ArrayList<>();
- }
-
- public void insert(Employee employee) {
- this.employees.add(employee);
- }
-
- public Employee findById(String id) {
- return this.employees.stream().filter(employee -> employee.getId().equals(id)).findFirst().orElse(null);
- }
-
- public boolean deleteById(String id) {
- Employee employee = this.findById(id);
- if (employee == null) {
- return false;
- }
- this.employees.remove(employee);
- return true;
- }
-
- /**
- * type = 0 => Experience
- * type = 1 => Fresher
- * type = 2 => Intern
- */
- public List findByType(int type) {
- return this.employees.stream()
- .filter(employee -> {
- if (type == 0) {
- return employee instanceof Experience;
- }
- if (type == 1) {
- return employee instanceof Fresher;
- }
- if (type == 2) {
- return employee instanceof Intern;
- }
- return false;
- })
- .collect(Collectors.toList());
- }
-
- public List findAll() {
- return this.employees;
- }
-
-
-}
diff --git a/oop_employee_management/src/service/ValidatorService.java b/oop_employee_management/src/service/ValidatorService.java
deleted file mode 100644
index 21e4996..0000000
--- a/oop_employee_management/src/service/ValidatorService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package service;
-
-import exception.BirthDayException;
-import exception.EmailException;
-import exception.FullNameException;
-import exception.PhoneException;
-
-import java.time.LocalDate;
-
-public class ValidatorService {
-
- public static void birthdayCheck(LocalDate birthday) throws BirthDayException {
- // TODO HERE
- }
-
- public static void phoneCheck(String phone) throws PhoneException {
- // TODO HERE
- }
-
- public static void emailCheck(String email) throws EmailException {
- // TODO HERE
- }
-
- public static void nameCheck(String name) throws FullNameException {
- // TODO HERE
- }
-}
diff --git a/oop_employee_management/src/ui/ScannerFactory.java b/oop_employee_management/src/ui/ScannerFactory.java
deleted file mode 100644
index 22e8137..0000000
--- a/oop_employee_management/src/ui/ScannerFactory.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package ui;
-
-import java.util.Scanner;
-
-public class ScannerFactory {
-
- private static Scanner SCANNER;
-
- public static Scanner getScanner() {
- if (SCANNER == null) {
- SCANNER = new Scanner(System.in);
- }
- return SCANNER;
- }
-}
diff --git a/oop_employee_management/src/ui/UIManager.java b/oop_employee_management/src/ui/UIManager.java
deleted file mode 100644
index 44b323c..0000000
--- a/oop_employee_management/src/ui/UIManager.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package ui;
-
-import entity.Employee;
-import entity.Experience;
-import entity.Fresher;
-import entity.Intern;
-import exception.BirthDayException;
-import exception.EmailException;
-import exception.FullNameException;
-import exception.PhoneException;
-import service.EmployeeManager;
-import service.ValidatorService;
-
-import java.util.Scanner;
-
-public class UIManager {
-
- private EmployeeManager employeeManager = new EmployeeManager();
-
- /**
- * @param type
- * @return Employee
- * type = 0 => Experience
- * type = 1 => Fresher
- * type = 2 => Intern
- */
- public void insert(int type) {
- Employee employee = null;
- if (type == 0) {
- employee = insertExperience();
- }
- if (type == 1) {
- employee = insertFresher();
- }
- if (type == 2) {
- employee = insertIntern();
- }
-
- try {
- checkData(employee);
- } catch (BirthDayException e) {
- // insert => insert(type);
- insert(type);
- } catch (PhoneException e) {
- // insert => insert(type);
- insert(type);
- } catch (EmailException e) {
- // insert => insert(type);
- insert(type);
- } catch (FullNameException e) {
- // insert => insert(type);
- insert(type);
- }
-
- this.employeeManager.insert(employee);
- }
-
- private Experience insertExperience() {
- Experience experience = new Experience();
- Scanner scanner = ScannerFactory.getScanner();
- System.out.print("Input ID: ");
- String id = scanner.nextLine();
- System.out.print("Input Name: ");
- String name = scanner.nextLine();
- System.out.print("Input Phone: ");
- String phone = scanner.nextLine();
- System.out.print("Input Email: ");
- String email = scanner.nextLine();
-
- // TODO
- return experience;
- }
-
- private Intern insertIntern() {
-
- Intern intern = new Intern();
- // TODO
- return intern;
- }
-
- private Fresher insertFresher() {
- Fresher fresher = new Fresher();
- // TODO
- return fresher;
- }
-
- public void update() {
- System.out.print("Input ID to update: ");
- String id = ScannerFactory.getScanner().nextLine();
- Employee employee = this.employeeManager.findById(id);
- // TODO HERE
- }
-
- public void delete() {
- System.out.print("Input ID to deleet: ");
- String id = ScannerFactory.getScanner().nextLine();
- this.employeeManager.deleteById(id);
- // TODO SHOW MESSAGE HERE
- }
-
- public void showAllEmployee() {
- this.employeeManager.findAll().forEach(Employee::showInformation);
- }
-
- private void checkData(Employee employee) throws BirthDayException, PhoneException, EmailException, FullNameException {
- ValidatorService.birthdayCheck(employee.getBirthday());
- ValidatorService.phoneCheck(employee.getPhone());
- ValidatorService.emailCheck(employee.getEmail());
- ValidatorService.nameCheck(employee.getFullName());
- }
-
- // TODO
-}
diff --git a/synthetic_exercise_oop_java/src/Main.java b/synthetic_exercise_oop_java/src/Main.java
deleted file mode 100644
index 91ba70b..0000000
--- a/synthetic_exercise_oop_java/src/Main.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class Main {
-
- public static void main(String[] args) {
- // You can run the exercise for earch package. In each package have Main class.
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b1/Engineer.java b/synthetic_exercise_oop_java/src/b1/Engineer.java
deleted file mode 100644
index 62193ca..0000000
--- a/synthetic_exercise_oop_java/src/b1/Engineer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package b1;
-
-import java.time.LocalDate;
-
-public class Engineer extends Officer {
- private String branch;
- public Engineer(String name, int age, String gender, String address, String branch) {
- super(name, age, gender, address);
- this.branch = branch;
- }
-
- public String getBranch() {
- return branch;
- }
-
- public void setBranch(String branch) {
- this.branch = branch;
- }
-
- @Override
- public String toString() {
- return "Engineer{" +
- "branch='" + branch + '\'' +
- ", name='" + name + '\'' +
- ", age=" + age +
- ", gender='" + gender + '\'' +
- ", address='" + address + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b1/Main.java b/synthetic_exercise_oop_java/src/b1/Main.java
deleted file mode 100644
index d8fbe23..0000000
--- a/synthetic_exercise_oop_java/src/b1/Main.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package b1;
-
-import java.util.Scanner;
-
-public class Main {
-
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- ManagerOfficer managerOfficer = new ManagerOfficer();
- while (true) {
- System.out.println("Application Manager Officer");
- System.out.println("Enter 1: To insert officer");
- System.out.println("Enter 2: To search officer by name: ");
- System.out.println("Enter 3: To show information officers");
- System.out.println("Enter 4: To exit:");
- String line = scanner.nextLine();
- switch (line) {
- case "1": {
- System.out.println("Enter a: to insert Enginner");
- System.out.println("Enter b: to insert Worker");
- System.out.println("Enter c: to insert Staff");
- String type = scanner.nextLine();
- switch (type) {
- case "a": {
- System.out.print("Enter name: ");
- String name = scanner.nextLine();
- System.out.print("Enter age:");
- int age = scanner.nextInt();
- System.out.print("Enter gender: ");
- scanner.nextLine();
- String gender = scanner.nextLine();
- System.out.print("Enter address: ");
- String address = scanner.nextLine();
- System.out.print("Enter branch: ");
- String branch = scanner.nextLine();
- Officer engineer = new Engineer(name, age, gender, address, branch);
- managerOfficer.addOfficer(engineer);
- System.out.println(engineer.toString());
- break;
-
- }
- case "b": {
- System.out.print("Enter name: ");
- String name = scanner.nextLine();
- System.out.print("Enter age:");
- int age = scanner.nextInt();
- System.out.print("Enter gender: ");
- scanner.nextLine();
- String gender = scanner.nextLine();
- System.out.print("Enter address: ");
- String address = scanner.nextLine();
- System.out.print("Enter level: ");
- int level = scanner.nextInt();
- Officer worker = new Worker(name, age, gender, address, level);
- managerOfficer.addOfficer(worker);
- System.out.println(worker.toString());
- scanner.nextLine();
- break;
- }
- case "c": {
- System.out.print("Enter name: ");
- String name = scanner.nextLine();
- System.out.print("Enter age: ");
- int age = scanner.nextInt();
- System.out.print("Enter gender: ");
- scanner.nextLine();
- String gender = scanner.nextLine();
- System.out.print("Enter address: ");
- String address = scanner.nextLine();
- System.out.print("Enter task: ");
- String task = scanner.nextLine();
- Officer staff = new Staff(name, age, gender, address, task);
- managerOfficer.addOfficer(staff);
- System.out.println(staff.toString());
- break;
- }
- default:
- System.out.println("Invalid");
- break;
- }
- break;
- }
- case "2": {
- System.out.print("Enter name to search: ");
- String name = scanner.nextLine();
- managerOfficer.searchOfficerByName(name).forEach(officer -> {
- System.out.println(officer.toString());
- });
- break;
- }
- case "3": {
- managerOfficer.showListInforOfficer();
- break;
- }
- case "4": {
- return;
- }
- default:
- System.out.println("Invalid");
- continue;
- }
-
- }
- }
-
-}
diff --git a/synthetic_exercise_oop_java/src/b1/ManagerOfficer.java b/synthetic_exercise_oop_java/src/b1/ManagerOfficer.java
deleted file mode 100644
index 376edfe..0000000
--- a/synthetic_exercise_oop_java/src/b1/ManagerOfficer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package b1;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class ManagerOfficer {
- private List officers;
-
- public ManagerOfficer() {
- this.officers = new ArrayList<>();
- }
-
- public void addOfficer(Officer officer) {
- this.officers.add(officer);
- }
-
- public List searchOfficerByName(String name) {
- return this.officers.stream().filter(o -> o.getName().contains(name)).collect(Collectors.toList());
- }
-
- public void showListInforOfficer() {
- this.officers.forEach(o -> System.out.println(o.toString()));
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b1/Officer.java b/synthetic_exercise_oop_java/src/b1/Officer.java
deleted file mode 100644
index 9b22132..0000000
--- a/synthetic_exercise_oop_java/src/b1/Officer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package b1;
-
-import java.time.LocalDate;
-
-public class Officer {
- protected String name;
- protected int age;
- protected String gender;
- protected String address;
-
- public Officer(String name, int age, String gender, String address) {
- this.name = name;
- this.age = age;
- this.gender = gender;
- this.address = address;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b1/Staff.java b/synthetic_exercise_oop_java/src/b1/Staff.java
deleted file mode 100644
index af58bad..0000000
--- a/synthetic_exercise_oop_java/src/b1/Staff.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package b1;
-
-import java.time.LocalDate;
-
-public class Staff extends Officer {
- private String task;
- public Staff(String name, int age, String gender, String address, String task) {
- super(name, age, gender, address);
- this.task = task;
- }
-
- public String getTask() {
- return task;
- }
-
- public void setTask(String task) {
- this.task = task;
- }
-
- @Override
- public String toString() {
- return "Staff{" +
- "task='" + task + '\'' +
- ", name='" + name + '\'' +
- ", age=" + age +
- ", gender='" + gender + '\'' +
- ", address='" + address + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b1/Worker.java b/synthetic_exercise_oop_java/src/b1/Worker.java
deleted file mode 100644
index 76aa86d..0000000
--- a/synthetic_exercise_oop_java/src/b1/Worker.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package b1;
-
-import java.time.LocalDate;
-
-public class Worker extends Officer {
- private int level;
-
- public Worker(String name, int age, String gender, String address, int level) {
- super(name, age, gender, address);
- this.level = level;
- }
-
- public int getLevel() {
- return level;
- }
-
- public void setLevel(int level) {
- this.level = level;
- }
-
- @Override
- public String toString() {
- return "Worker{" +
- "level=" + level +
- ", name='" + name + '\'' +
- ", age=" + age +
- ", gender='" + gender + '\'' +
- ", address='" + address + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b2/Book.java b/synthetic_exercise_oop_java/src/b2/Book.java
deleted file mode 100644
index 9c3afc1..0000000
--- a/synthetic_exercise_oop_java/src/b2/Book.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package b2;
-
-public class Book extends Document {
- private String author;
- private int numerPage;
-
-
- public Book(String id, String nxb, int number, String author, int numberPage) {
- super(id, nxb, number);
- this.author = author;
- this.numerPage = numberPage;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public int getNumerPage() {
- return numerPage;
- }
-
- public void setNumerPage(int numerPage) {
- this.numerPage = numerPage;
- }
-
- @Override
- public String toString() {
- return "Book{" +
- "author='" + author + '\'' +
- ", numerPage=" + numerPage +
- ", id='" + id + '\'' +
- ", nxb='" + nxb + '\'' +
- ", number='" + number + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b2/Document.java b/synthetic_exercise_oop_java/src/b2/Document.java
deleted file mode 100644
index a6552e5..0000000
--- a/synthetic_exercise_oop_java/src/b2/Document.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package b2;
-
-public class Document {
- protected String id;
- protected String nxb;
- protected int number;
-
- public Document(String id, String nxb, int number) {
- this.id = id;
- this.nxb = nxb;
- this.number = number;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getNxb() {
- return nxb;
- }
-
- public void setNxb(String nxb) {
- this.nxb = nxb;
- }
-
- public int getNumber() {
- return number;
- }
-
- public void setNumber(int number) {
- this.number = number;
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b2/Journal.java b/synthetic_exercise_oop_java/src/b2/Journal.java
deleted file mode 100644
index 56d2586..0000000
--- a/synthetic_exercise_oop_java/src/b2/Journal.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package b2;
-
-public class Journal extends Document {
-
- private int issueNumber;
- private int monthIssue;
-
- public Journal(String id, String nxb, int number, int issueNumber, int monthIssue) {
- super(id, nxb, number);
- this.issueNumber = issueNumber;
- this.monthIssue = monthIssue;
- }
-
- public int getIssueNumber() {
- return issueNumber;
- }
-
- public void setIssueNumber(int issueNumber) {
- this.issueNumber = issueNumber;
- }
-
- public int getMonthIssue() {
- return monthIssue;
- }
-
- public void setMonthIssue(int monthIssue) {
- this.monthIssue = monthIssue;
- }
-
- @Override
- public String toString() {
- return "Journal{" +
- "issueNumber=" + issueNumber +
- ", monthIssue=" + monthIssue +
- ", id='" + id + '\'' +
- ", nxb='" + nxb + '\'' +
- ", number='" + number + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b2/Main.java b/synthetic_exercise_oop_java/src/b2/Main.java
deleted file mode 100644
index 88cf261..0000000
--- a/synthetic_exercise_oop_java/src/b2/Main.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package b2;
-
-import b1.ManagerOfficer;
-
-import java.util.Scanner;
-
-public class Main {
-
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- ManagerDocument managerDocument = new ManagerDocument();
- while (true) {
- System.out.println("Application Manager Document");
- System.out.println("Enter 1: To insert document");
- System.out.println("Enter 2: To search document by category: ");
- System.out.println("Enter 3: To show information documents");
- System.out.println("Enter 4: To remove document by id");
- System.out.println("Enter 5: To exit:");
- String line = scanner.nextLine();
- switch (line) {
- case "1": {
- System.out.println("Enter a: to insert Book");
- System.out.println("Enter b: to insert Newspaper");
- System.out.println("Enter c: to insert Journal");
- String type = scanner.nextLine();
- switch (type) {
- case "a": {
- System.out.print("Enter ID: ");
- String id = scanner.nextLine();
- System.out.print("Enter nxb:");
- String nxb = scanner.nextLine();
- System.out.print("Enter number: ");
- int number = scanner.nextInt();
- System.out.print("Enter author: ");
- scanner.nextLine();
- String author = scanner.nextLine();
- System.out.print("Enter page number: ");
- int pageNumber = scanner.nextInt();
- Document book = new Book(id, nxb, number, author, pageNumber);
- managerDocument.addDocument(book);
- System.out.println(book.toString());
- scanner.nextLine();
- break;
-
- }
- case "b": {
- System.out.print("Enter ID: ");
- String id = scanner.nextLine();
- System.out.print("Enter nxb:");
- String nxb = scanner.nextLine();
- System.out.print("Enter number: ");
- int number = scanner.nextInt();
- System.out.print("Enter Day issue: ");
- int dayIssue = scanner.nextInt();
- Document newspaper = new Newspaper(id, nxb, number, dayIssue);
- managerDocument.addDocument(newspaper);
- System.out.println(newspaper.toString());
- scanner.nextLine();
- break;
- }
- case "c": {
- System.out.print("Enter ID: ");
- String id = scanner.nextLine();
- System.out.print("Enter nxb:");
- String nxb = scanner.nextLine();
- System.out.print("Enter number: ");
- int number = scanner.nextInt();
- System.out.print("Enter issue number : ");
- int issueNumber = scanner.nextInt();
- System.out.print("Enter issue month : ");
- int issueMonth = scanner.nextInt();
- Document journal = new Journal(id, nxb, number, issueNumber, issueMonth);
- managerDocument.addDocument(journal);
- System.out.println(journal.toString());
- scanner.nextLine();
- break;
- }
- default:
- break;
- }
- break;
- }
- case "2": {
- System.out.println("Enter a to search book");
- System.out.println("Enter b to search newspaper");
- System.out.println("Enter a to search journal");
- String choise = scanner.nextLine();
- switch (choise) {
- case "a": {
- managerDocument.searchByBook();
- break;
- }
- case "b": {
- managerDocument.searchByNewspaper();
- break;
- }
- case "c":
- managerDocument.searchByJournal();
- break;
- default:
- System.out.println("Invalid");
- break;
- }
- break;
- }
- case "3": {
- managerDocument.showInfor();
- break;
- }
- case "4": {
- System.out.print("Enter id to remove: ");
- String id = scanner.nextLine();
- System.out.println(managerDocument.deleteDocument(id) ? "Success" : "Fail");
- }
- break;
- case "5": {
- return;
- }
- default:
- System.out.println("Invalid");
- continue;
- }
-
- }
- }
-
-}
diff --git a/synthetic_exercise_oop_java/src/b2/ManagerDocument.java b/synthetic_exercise_oop_java/src/b2/ManagerDocument.java
deleted file mode 100644
index 14d765a..0000000
--- a/synthetic_exercise_oop_java/src/b2/ManagerDocument.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package b2;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ManagerDocument {
- List documents;
-
- public ManagerDocument() {
- this.documents = new ArrayList<>();
- }
-
- public void addDocument(Document document) {
- this.documents.add(document);
- }
-
- public boolean deleteDocument(String id) {
- Document doc = this.documents.stream()
- .filter(document -> document.getId().equals(id))
- .findFirst().orElse(null);
- if (doc == null) {
- return false;
- }
- this.documents.remove(doc);
- return true;
- }
-
- public void showInfor() {
- this.documents.forEach(documents -> System.out.println(documents.toString()));
- }
-
- public void searchByBook() {
- this.documents.stream().filter(doc -> doc instanceof Book).forEach(doc -> System.out.println(doc.toString()));
- }
-
- public void searchByNewspaper() {
- this.documents.stream().filter(doc -> doc instanceof Newspaper).forEach(doc -> System.out.println(doc.toString()));
- }
-
- public void searchByJournal() {
- this.documents.stream().filter(doc -> doc instanceof Journal).forEach(doc -> System.out.println(doc.toString()));
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b2/Newspaper.java b/synthetic_exercise_oop_java/src/b2/Newspaper.java
deleted file mode 100644
index 5f572d4..0000000
--- a/synthetic_exercise_oop_java/src/b2/Newspaper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package b2;
-
-public class Newspaper extends Document {
- private int dayIssue;
-
- public Newspaper(String id, String nxb, int number, int dayIssue) {
- super(id, nxb, number);
- this.dayIssue = dayIssue;
- }
-
- public int getDayIssue() {
- return dayIssue;
- }
-
- public void setDayIssue(int dayIssue) {
- this.dayIssue = dayIssue;
- }
-
- @Override
- public String toString() {
- return "Newspaper{" +
- "dayIssue=" + dayIssue +
- ", id='" + id + '\'' +
- ", nxb='" + nxb + '\'' +
- ", number='" + number + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b3/Candidate.java b/synthetic_exercise_oop_java/src/b3/Candidate.java
deleted file mode 100644
index ec5cb47..0000000
--- a/synthetic_exercise_oop_java/src/b3/Candidate.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package b3;
-
-public class Candidate {
- protected String id;
- protected String name;
- protected String address;
- protected int priority;
-
- public Candidate(String id, String name, String address, int priority) {
- this.id = id;
- this.name = name;
- this.address = address;
- this.priority = priority;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public int getPriority() {
- return priority;
- }
-
- public void setPriority(int priority) {
- this.priority = priority;
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b3/CandidateA.java b/synthetic_exercise_oop_java/src/b3/CandidateA.java
deleted file mode 100644
index 6a2fcfa..0000000
--- a/synthetic_exercise_oop_java/src/b3/CandidateA.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package b3;
-
-public class CandidateA extends Candidate {
- public static final String MON_TOAN = "Toan";
- public static final String MON_LY = "Ly";
- public static final String MON_HOA = "Hoa";
- public CandidateA(String id, String name, String address, int priority) {
- super(id, name, address, priority);
- }
-
- @Override
- public String toString() {
- return "CandidateA{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", address='" + address + '\'' +
- ", priority=" + priority + ", Subject: " + MON_TOAN + " - " + MON_LY + " - " + MON_HOA +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b3/CandidateB.java b/synthetic_exercise_oop_java/src/b3/CandidateB.java
deleted file mode 100644
index 8afc14e..0000000
--- a/synthetic_exercise_oop_java/src/b3/CandidateB.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package b3;
-
-public class CandidateB extends Candidate {
-
- public static final String MON_TOAN = "Toan";
- public static final String MON_HOA = "Hoa";
- public static final String MON_SINH = "Sinh";
-
- public CandidateB(String id, String name, String address, int priority) {
- super(id, name, address, priority);
- }
-
- @Override
- public String toString() {
- return "CandidateB{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", address='" + address + '\'' +
- ", priority=" + priority + ", Subject: " + MON_TOAN + " - " + MON_SINH + " - " + MON_HOA +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b3/CandidateC.java b/synthetic_exercise_oop_java/src/b3/CandidateC.java
deleted file mode 100644
index 15242bb..0000000
--- a/synthetic_exercise_oop_java/src/b3/CandidateC.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package b3;
-
-public class CandidateC extends Candidate {
-
- public static final String MON_VAN = "Van";
- public static final String MON_SU = "Su";
- public static final String MON_DIA = "Dia";
-
- public CandidateC(String id, String name, String address, int priority) {
- super(id, name, address, priority);
- }
-
- @Override
- public String toString() {
- return "CandidateC{" +
- "id='" + id + '\'' +
- ", name='" + name + '\'' +
- ", address='" + address + '\'' +
- ", priority=" + priority + ", Subject: " + MON_VAN + " - " + MON_SU + " - " + MON_DIA +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b3/Main.java b/synthetic_exercise_oop_java/src/b3/Main.java
deleted file mode 100644
index daa0aaf..0000000
--- a/synthetic_exercise_oop_java/src/b3/Main.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package b3;
-
-import java.util.Scanner;
-
-public class Main {
-
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- ManagerCandidate managerCandidate = new ManagerCandidate();
- while (true) {
- System.out.println("Application Manager Candidate");
- System.out.println("Enter 1: To insert candidate");
- System.out.println("Enter 2: To show information of candidate: ");
- System.out.println("Enter 3: To search candidate by id");
- System.out.println("Enter 4: To exit:");
- String line = scanner.nextLine();
- switch (line) {
- case "1": {
- System.out.println("Enter a: to insert Candidate A");
- System.out.println("Enter b: to insert Candidate B");
- System.out.println("Enter c: to insert Candidate C");
- String type = scanner.nextLine();
- switch (type) {
- case "a": {
- managerCandidate.add(createCadidate(scanner, "a"));
- break;
-
- }
- case "b": {
- managerCandidate.add(createCadidate(scanner, "b"));
- break;
- }
- case "c": {
- managerCandidate.add(createCadidate(scanner, "c"));
- break;
- }
- default:
- System.out.println("Invalid");
- break;
- }
- break;
- }
- case "2": {
- managerCandidate.showInfor();
- break;
- }
- case "3": {
- System.out.print("Enter ID: ");
- String id = scanner.nextLine();
- Candidate candidate = managerCandidate.searchById(id);
- if (candidate == null) {
- System.out.println("Not found");
- } else {
- System.out.println(candidate.toString());
- }
- break;
- }
- case "4": {
- return;
- }
- default:
- System.out.println("Invalid");
- continue;
- }
-
- }
- }
-
- public static Candidate createCadidate(Scanner scanner, String cate) {
- System.out.print("Enter ID: ");
- String id = scanner.nextLine();
- System.out.print("Enter name: ");
- String name = scanner.nextLine();
- System.out.print("Enter address: ");
- String address = scanner.nextLine();
- System.out.print("Enter Priotity: ");
- int priority = scanner.nextInt();
- scanner.nextLine();
- if (cate.equals("a")) {
- return new CandidateA(id, name,address,priority);
- } else if (cate.equals("b")) {
- return new CandidateB(id, name,address,priority);
- } else {
- return new CandidateC(id, name,address,priority);
- }
-
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b3/ManagerCandidate.java b/synthetic_exercise_oop_java/src/b3/ManagerCandidate.java
deleted file mode 100644
index 7ed3d96..0000000
--- a/synthetic_exercise_oop_java/src/b3/ManagerCandidate.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package b3;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ManagerCandidate {
- List candidates;
- public ManagerCandidate() {
- this.candidates = new ArrayList<>();
- }
-
- public void add(Candidate candidate) {
- this.candidates.add(candidate);
- }
-
- public void showInfor() {
- this.candidates.forEach(candidate -> System.out.println(candidate.toString()));
- }
-
- public Candidate searchById(String id) {
- return this.candidates.stream().filter(candidate -> candidate.getId().equals(id)).findFirst().orElse(null);
- }
-
-
-}
diff --git a/synthetic_exercise_oop_java/src/b4/Family.java b/synthetic_exercise_oop_java/src/b4/Family.java
deleted file mode 100644
index 72aa52f..0000000
--- a/synthetic_exercise_oop_java/src/b4/Family.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package b4;
-
-import java.util.List;
-
-public class Family {
- private List presons;
- private String address;
-
- public Family(List presons, String address) {
- this.presons = presons;
- this.address = address;
- }
-
- public List getPresons() {
- return presons;
- }
-
- public void setPresons(List presons) {
- this.presons = presons;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- @Override
- public String toString() {
- return "Family{" +
- "presons=" + presons +
- ", address='" + address + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b4/Main.java b/synthetic_exercise_oop_java/src/b4/Main.java
deleted file mode 100644
index 382ba01..0000000
--- a/synthetic_exercise_oop_java/src/b4/Main.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package b4;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Scanner;
-
-// This is sudo code. To overview how to do it.
-// You can finish by fill you code
-
-public class Main {
- public static void main(String[] args) {
- Town town = new Town();
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter n:");
- int n = scanner.nextInt();
- for(int i = 0; i < n; i++) {
- // Input foreach famili
-
- System.out.println("Enter address:");
- scanner.nextLine();
- String address = scanner.nextLine();
-
- // Enter person number in family
- List persons = new ArrayList<>();
- System.out.println("Enter number person");
- int number = scanner.nextInt();
-
- for (int j = 0; j < number; j++) {
- // Inout person for family
- }
-
- // After done input
- town.addFamily(new Family(persons,address ));
-
-
- }
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b4/Person.java b/synthetic_exercise_oop_java/src/b4/Person.java
deleted file mode 100644
index 057a494..0000000
--- a/synthetic_exercise_oop_java/src/b4/Person.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package b4;
-
-public class Person {
- private String name;
- private int age;
- private String job;
- private String passport;
-
- public Person(String name, int age, String job, String passport) {
- this.name = name;
- this.age = age;
- this.job = job;
- this.passport = passport;
- }
-
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getJob() {
- return job;
- }
-
- public void setJob(String job) {
- this.job = job;
- }
-
- public String getPassport() {
- return passport;
- }
-
- public void setPassport(String passport) {
- this.passport = passport;
- }
-
- @Override
- public String toString() {
- return "Person{" +
- "name='" + name + '\'' +
- ", age=" + age +
- ", job='" + job + '\'' +
- ", passport='" + passport + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b4/Town.java b/synthetic_exercise_oop_java/src/b4/Town.java
deleted file mode 100644
index 82b3ee8..0000000
--- a/synthetic_exercise_oop_java/src/b4/Town.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package b4;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Town {
- List families;
-
- public Town() {
- this.families = new ArrayList<>();
- }
-
- public List getFamilies() {
- return families;
- }
-
- public void setFamilies(List families) {
- this.families = families;
- }
-
- public void addFamily(Family family) {
- this.families.add(family);
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b5/Hotel.java b/synthetic_exercise_oop_java/src/b5/Hotel.java
deleted file mode 100644
index 42b9317..0000000
--- a/synthetic_exercise_oop_java/src/b5/Hotel.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package b5;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Hotel {
- private List persons;
-
- public Hotel() {
- persons = new ArrayList<>();
- }
-
- public void add(Person person) {
- this.persons.add(person);
- }
-
- public boolean delete(String passport) {
- Person person = this.persons.stream().filter(p -> p.getPassport().equals(passport)).findFirst().orElse(null);
- if (person == null) {
- return false;
- } else {
- this.persons.remove(person);
- return true;
- }
- }
-
- public int calculator(String passport) {
- Person person = this.persons.stream().filter(p -> p.getPassport().equals(passport)).findFirst().orElse(null);
- if (person == null) {
- return 0;
- }
- return person.getRoom().getPrice() * person.getNumberRent();
- }
-
- public void show() {
- this.persons.forEach(p -> System.out.println(p.toString()));
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b5/Main.java b/synthetic_exercise_oop_java/src/b5/Main.java
deleted file mode 100644
index 47c259f..0000000
--- a/synthetic_exercise_oop_java/src/b5/Main.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package b5;
-
-import java.util.Scanner;
-
-public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- Hotel hotel = new Hotel();
- while (true) {
- System.out.println("Application Manager Candidate");
- System.out.println("Enter 1: To insert person for rent");
- System.out.println("Enter 2: To remove person by passport");
- System.out.println("Enter 3: To calculator price by passport");
- System.out.println("Enter 4: To show infor");
- System.out.println("Enter 5: To exit:");
- String line = scanner.nextLine();
- switch(line) {
- case "1": {
- System.out.print("Enter name: ");
- String name = scanner.nextLine();
- System.out.print("Enter age: ");
- int age = scanner.nextInt();
- System.out.print("Enter passport: ");
- scanner.nextLine();
- String passport = scanner.nextLine();
- System.out.println("Choise a to rent room type A");
- System.out.println("Choise b to rent room type B");
- System.out.println("Choise c to rent room type C");
- String choise = scanner.nextLine();
- Room room;
- if (choise.equals("a")) {
- room = new RoomA();
- } else if (choise.equals("b")) {
- room = new RoomB();
- } else if (choise.equals("c")) {
- room = new RoomC();
- } else {
- continue;
- }
- System.out.print("Enter number day for rent: ");
- int numberRent = scanner.nextInt();
- Person person = new Person(name, age, passport, room, numberRent);
- hotel.add(person);
- scanner.nextLine();
- break;
- }
- case "2": {
- System.out.print("Enter passport: ");
- String passport = scanner.nextLine();
- hotel.delete(passport);
- break;
- }
- case "3": {
- System.out.print("Enter passport: ");
- String passport = scanner.nextLine();
- System.out.println("Price: " + hotel.calculator(passport));
- break;
- }
- case "4": {
- hotel.show();
- break;
- }
- case "5": {
- return;
- }
- default:
- System.out.println("Invalid");
- continue;
- }
- }
-
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b5/Person.java b/synthetic_exercise_oop_java/src/b5/Person.java
deleted file mode 100644
index 1f85bac..0000000
--- a/synthetic_exercise_oop_java/src/b5/Person.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package b5;
-
-public class Person {
- private String name;
- private int age;
- private String passport;
- private Room room;
- private int numberRent;
-
- public Person(String name, int age, String passport, Room room, int numberRent) {
- this.name = name;
- this.age = age;
- this.passport = passport;
- this.numberRent = numberRent;
- this.room = room;
- }
-
- public int getNumberRent() {
- return numberRent;
- }
-
- public void setNumberRent(int numberRent) {
- this.numberRent = numberRent;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getPassport() {
- return passport;
- }
-
- public void setPassport(String passport) {
- this.passport = passport;
- }
-
- public Room getRoom() {
- return room;
- }
-
- public void setRoom(Room room) {
- this.room = room;
- }
-
- @Override
- public String toString() {
- return "Person{" +
- "name='" + name + '\'' +
- ", age=" + age +
- ", passport='" + passport + '\'' + room.toString() +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b5/Room.java b/synthetic_exercise_oop_java/src/b5/Room.java
deleted file mode 100644
index 3d761a2..0000000
--- a/synthetic_exercise_oop_java/src/b5/Room.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package b5;
-
-public class Room {
- protected String category;
- protected int price;
-
- public Room(String category, int price) {
- this.category = category;
- this.price = price;
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public int getPrice() {
- return price;
- }
-
- public void setPrice(int price) {
- this.price = price;
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b5/RoomA.java b/synthetic_exercise_oop_java/src/b5/RoomA.java
deleted file mode 100644
index 5157f66..0000000
--- a/synthetic_exercise_oop_java/src/b5/RoomA.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package b5;
-
-public class RoomA extends Room {
-
- public RoomA() {
- super("A", 500);
- }
-
- @Override
- public String toString() {
- return "RoomA{" +
- "category='" + category + '\'' +
- ", price=" + price +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b5/RoomB.java b/synthetic_exercise_oop_java/src/b5/RoomB.java
deleted file mode 100644
index fcb01d2..0000000
--- a/synthetic_exercise_oop_java/src/b5/RoomB.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package b5;
-
-public class RoomB extends Room {
- public RoomB() {
- super("B", 300);
- }
-
- @Override
- public String toString() {
- return "RoomB{" +
- "category='" + category + '\'' +
- ", price=" + price +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b5/RoomC.java b/synthetic_exercise_oop_java/src/b5/RoomC.java
deleted file mode 100644
index 48f7c53..0000000
--- a/synthetic_exercise_oop_java/src/b5/RoomC.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package b5;
-
-public class RoomC extends Room {
- public RoomC() {
- super("C", 100);
- }
-
- @Override
- public String toString() {
- return "RoomC{" +
- "category='" + category + '\'' +
- ", price=" + price +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b6/Main.java b/synthetic_exercise_oop_java/src/b6/Main.java
deleted file mode 100644
index 594ac5a..0000000
--- a/synthetic_exercise_oop_java/src/b6/Main.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package b6;
-
-import java.util.Scanner;
-
-public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
-
- School school = new School();
-
- // add Student to school by func add(). for ex: school.add(new Student(// infor);
-
- school.getStudent20YearOld();
-
- school.countStudent23YearOldInDN();
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b6/School.java b/synthetic_exercise_oop_java/src/b6/School.java
deleted file mode 100644
index 9a91a34..0000000
--- a/synthetic_exercise_oop_java/src/b6/School.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package b6;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class School {
- private List students;
-
- public School() {
- this.students = new ArrayList<>();
- }
-
- public void add(Student student) {
- this.students.add(student);
- }
-
- public List getStudent20YearOld() {
- return this.students.stream().filter(student -> student.getAge() == 20).collect(Collectors.toList());
- }
-
- public long countStudent23YearOldInDN() {
- return this.students.stream().filter(student -> student.getAge() == 23 && student.getHometown().equals("DN")).count();
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b6/Student.java b/synthetic_exercise_oop_java/src/b6/Student.java
deleted file mode 100644
index c1c6650..0000000
--- a/synthetic_exercise_oop_java/src/b6/Student.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package b6;
-
-public class Student {
- private String name;
- private int age;
- private String hometown;
- private int classStudent;
-
- public Student(String name, int age, String hometown, int classStudent) {
- this.name = name;
- this.age = age;
- this.hometown = hometown;
- this.classStudent = classStudent;
- }
-
- public int getClassStudent() {
- return classStudent;
- }
-
- public void setClassStudent(int classStudent) {
- this.classStudent = classStudent;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getHometown() {
- return hometown;
- }
-
- public void setHometown(String hometown) {
- this.hometown = hometown;
- }
-
- @Override
- public String toString() {
- return "Student{" +
- "name='" + name + '\'' +
- ", age=" + age +
- ", hometown='" + hometown + '\'' +
- '}';
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b7/Main.java b/synthetic_exercise_oop_java/src/b7/Main.java
deleted file mode 100644
index b3668df..0000000
--- a/synthetic_exercise_oop_java/src/b7/Main.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package b7;
-
-import java.util.Scanner;
-
-public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- ManagerTeacher managerTeacher = new ManagerTeacher();
- while (true) {
- // show input for user choise
- // 1 to insert
- // 2 to remove => input id. output boolean
- // 4 get salary => input id. output double
- // 5 exit => return
-
- }
- }
-
-}
diff --git a/synthetic_exercise_oop_java/src/b7/ManagerTeacher.java b/synthetic_exercise_oop_java/src/b7/ManagerTeacher.java
deleted file mode 100644
index 5ee02e7..0000000
--- a/synthetic_exercise_oop_java/src/b7/ManagerTeacher.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package b7;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ManagerTeacher {
- private List teachers;
-
- public ManagerTeacher() {
- this.teachers = new ArrayList<>();
- }
-
- public void add(Teacher teacher) {
- this.teachers.add(teacher);
- }
-
- public boolean deleteById(String id) {
- Teacher teacher = this.teachers.stream().filter(t -> t.getId().equals(id)).findFirst().orElse(null);
- if (teacher == null) {
- return false;
- }
- this.teachers.remove(teacher);
- return true;
- }
-
- public double getSalary(String id) {
- Teacher teacher = this.teachers.stream().filter(t -> t.getId().equals(id)).findFirst().orElse(null);
- if (teacher == null) {
- return 0;
- }
- return teacher.getSalary() + teacher.getBonus() + teacher.getPenaty();
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b7/Teacher.java b/synthetic_exercise_oop_java/src/b7/Teacher.java
deleted file mode 100644
index a3cc9d3..0000000
--- a/synthetic_exercise_oop_java/src/b7/Teacher.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package b7;
-
-public class Teacher {
- private double salary;
- private double bonus;
- private double penaty;
- private double realSalary;
- private String name;
- private int age;
- private String hometown;
- private String id;
-
-
- public Teacher(double salary, double bonus, double penaty, double realSalary, String name, int age, String hometown, String id) {
- this.salary = salary;
- this.bonus = bonus;
- this.penaty = penaty;
- this.realSalary = realSalary;
- this.name = name;
- this.age = age;
- this.hometown = hometown;
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getHometown() {
- return hometown;
- }
-
- public void setHometown(String hometown) {
- this.hometown = hometown;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public double getSalary() {
- return salary;
- }
-
- public void setSalary(double salary) {
- this.salary = salary;
- }
-
- public double getBonus() {
- return bonus;
- }
-
- public void setBonus(double bonus) {
- this.bonus = bonus;
- }
-
- public double getPenaty() {
- return penaty;
- }
-
- public void setPenaty(double penaty) {
- this.penaty = penaty;
- }
-
- public double getRealSalary() {
- return realSalary;
- }
-
- public void setRealSalary(double realSalary) {
- this.realSalary = realSalary;
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b8/Card.java b/synthetic_exercise_oop_java/src/b8/Card.java
deleted file mode 100644
index 7bf14c1..0000000
--- a/synthetic_exercise_oop_java/src/b8/Card.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package b8;
-
-public class Card {
- private Student student;
- private String id;
- private int borrowDate;
- private int paymentDate;
- private int bookId;
-
- public Card(Student student, String id, int borrowDate, int paymentDate, int bookId) {
- this.student = student;
- this.id = id;
- this.borrowDate = borrowDate;
- this.paymentDate = paymentDate;
- this.bookId = bookId;
- }
-
- public Student getStudent() {
- return student;
- }
-
- public void setStudent(Student student) {
- this.student = student;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public int getBorrowDate() {
- return borrowDate;
- }
-
- public void setBorrowDate(int borrowDate) {
- this.borrowDate = borrowDate;
- }
-
- public int getPaymentDate() {
- return paymentDate;
- }
-
- public void setPaymentDate(int paymentDate) {
- this.paymentDate = paymentDate;
- }
-
- public int getBookId() {
- return bookId;
- }
-
- public void setBookId(int bookId) {
- this.bookId = bookId;
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b8/Main.java b/synthetic_exercise_oop_java/src/b8/Main.java
deleted file mode 100644
index a0106a3..0000000
--- a/synthetic_exercise_oop_java/src/b8/Main.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package b8;
-
-import java.util.Scanner;
-
-public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- ManagerCard managerCard = new ManagerCard();
- while (true) {
- // show input for user choise
- // 1 to insert
- // 2 to remove => input id. output boolean
- // 4 get salary => input id. output double
- // 5 exit => return
-
- }
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b8/ManagerCard.java b/synthetic_exercise_oop_java/src/b8/ManagerCard.java
deleted file mode 100644
index f9aec48..0000000
--- a/synthetic_exercise_oop_java/src/b8/ManagerCard.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package b8;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ManagerCard {
-
- private List cards;
-
- public ManagerCard() {
- this.cards = new ArrayList<>();
- }
-
- public void add(Card card) {
- this.cards.add(card);
- }
-
- public boolean delete(String id) {
- Card card = this.cards.stream().filter(t -> t.getId().equals(id)).findFirst().orElse(null);
- if (card == null) {
- return false;
- }
- this.cards.remove(card);
- return true;
- }
-}
diff --git a/synthetic_exercise_oop_java/src/b8/Student.java b/synthetic_exercise_oop_java/src/b8/Student.java
deleted file mode 100644
index c01e5fe..0000000
--- a/synthetic_exercise_oop_java/src/b8/Student.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package b8;
-
-public class Student {
- private String name;
- private int age;
- private String school;
-
- public Student(String name, int age, String school) {
- this.name = name;
- this.age = age;
- this.school = school;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getSchool() {
- return school;
- }
-
- public void setSchool(String school) {
- this.school = school;
- }
-}
diff --git a/synthetic_exercise_oop_java/synthetic_exercise_oop_java.iml b/synthetic_exercise_oop_java/synthetic_exercise_oop_java.iml
deleted file mode 100644
index c90834f..0000000
--- a/synthetic_exercise_oop_java/synthetic_exercise_oop_java.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file