[qlks]qlyksan
Class con nguoi
import java.util.Date;
import java.util.Scanner;
public class ConNguoi{
public String ten;
public String gioiTinh;
public Date namSinh;
public String diaChi;
public String sdt;
public ConNguoi(){
;
;
namSinh=new Date();
;
;
}
public ConNguoi(ConNguoi a) {
this.ten=a.ten;
this.gioiTinh=a.gioiTinh;
this.namSinh=a.namSinh;
this.diaChi=a.diaChi;
this.sdt=a.sdt;
}
public void nhap(){
Scanner sc=new Scanner(System.in);
System.out.println("Nhap ten: ");
ten=sc.nextLine();
System.out.println("Nhap gioi tinh: ");
gioiTinh=sc.nextLine();
System.out.println("Nhap nam sinh: ");
namSinh=new Date(sc.nextLine());
System.out.println("Nhap dia chi: ");
diaChi=sc.nextLine();
System.out.println("Nhap so dien thoai: ");
sdt=sc.nextLine();
}
public void xuat() {
System.out.println("Ten: "+ten);
System.out.println("Gioi tinh: "+gioiTinh);
System.out.println("Nam sinh: "+namSinh);
System.out.println("Dia chi: "+diaChi);
System.out.println("So dien thoai: "+sdt);
}
}
Class Khach hang
import java.util.Date;
import java.util.Scanner;
public class KhachHang extends ConNguoi{
public String maKH;
public Date ngayDatPhong;
public Date ngayTraPhong;
public String soPhongdat;
public String Cmnd;
public KhachHang(){
super();
;
ngayDatPhong=new Date();
ngayTraPhong=new Date();
soPhongdat="";
;
}
public KhachHang(KhachHang a) {
super(a);
this.maKH=a.maKH;
this.ngayDatPhong=a.ngayDatPhong;
this.ngayTraPhong=a.ngayTraPhong;
this.soPhongdat=a.soPhongdat;
this.Cmnd=a.Cmnd;
}
public void nhap(){
super.nhap();
Scanner sc=new Scanner(System.in);
System.out.println("Nhap ma khach hang: ");
maKH= sc.nextLine();
System.out.println("Nhap ngay dat phong: ");
ngayDatPhong=new Date(sc.nextLine());
System.out.println("Nhap ngay tra phong:");
ngayTraPhong=new Date(sc.nextLine());
System.out.println("Nhap so phong dat: ");
soPhongdat=sc.nextLine();
System.out.println("Nhap so chung minh nhan dan: ");
Cmnd=sc.nextLine();
}
public void xuat() {
super.xuat();
System.out.println("Ma khach hang: "+maKH);
System.out.println("Ngay dat phong: "+ngayDatPhong);
System.out.println("Ngay tra phong:"+ngayTraPhong);
System.out.println("So phong dat: "+soPhongdat);
System.out.println("So Chung minh nhan dan: "+Cmnd);
}
}
Class nhan vien
import java.util.Date;
import java.util.Scanner;
public abstract class NhanVien extends ConNguoi{
public String maNV;
public Date ngayVL;
public long luong;
public NhanVien(){
super();
;
ngayVL=new Date();
luong=0;
}
public NhanVien(NhanVien a) {
super(a);
this.maNV=a.maNV;
this.ngayVL=a.ngayVL;
this.luong=a.luong;
}
public void nhap(){
super.nhap();
Scanner sc=new Scanner(System.in);
System.out.println("Nhap ma nhan vien: ");
maNV=sc.nextLine();
System.out.println("Nhap ngay vao lam: ");
ngayVL=new Date(sc.nextLine());
System.out.println("Nhap luong can ban: ");
luong=sc.nextLong();
sc.nextLine();
}
public void xuat() {
super.xuat();
System.out.println("Ma nhan vien: "+maNV);
System.out.println("Ngay vao lam: "+ngayVL);
System.out.println("Luong can ban: "+luong);
}
public String loaiNV(){
return "";
}
abstract public void nhapLuong();
abstract public long luong();
}
Class nhan vien QL
import java.util.Date;
import java.util.Scanner;
public abstract class NhanVien extends ConNguoi{
public String maNV;
public Date ngayVL;
public long luong;
public NhanVien() {
super();
;
ngayVL=new Date();
luong=0;
}
public NhanVien(NhanVien a) {
super(a);
this.maNV=a.maNV;
this.ngayVL=a.ngayVL;
this.luong=a.luong;
}
public void nhap(){
super.nhap();
Scanner sc=new Scanner(System.in);
System.out.println("Nhap ma nhan vien: ");
maNV=sc.nextLine();
System.out.println("Nhap ngay vao lam: ");
ngayVL=new Date(sc.nextLine());
System.out.println("Nhap luong can ban: ");
luong=sc.nextLong();
sc.nextLine();
}
public void xuat() {
super.xuat();
System.out.println("Ma nhan vien: "+maNV);
System.out.println("Ngay vao lam: "+ngayVL);
System.out.println("Luong can ban: "+luong);
}
public String loaiNV() {
return "";
}
abstract public void nhapLuong();
abstract public long luong();
}
Class nhan vien thuong
import java.util.Date;
import java.util.Scanner;
public abstract class NhanVien extends ConNguoi{
public String maNV;
public Date ngayVL;
public long luong;
public NhanVien(){
super();
;
ngayVL=new Date();
luong=0;
}
public NhanVien(NhanVien a) {
super(a);
this.maNV=a.maNV;
this.ngayVL=a.ngayVL;
this.luong=a.luong;
}
public void nhap(){
super.nhap();
Scanner sc=new Scanner(System.in);
System.out.println("Nhap ma nhan vien: ");
maNV=sc.nextLine();
System.out.println("Nhap ngay vao lam: ");
ngayVL=new Date(sc.nextLine());
System.out.println("Nhap luong can ban: ");
luong=sc.nextLong();
sc.nextLine();
}
public void xuat()
{
super.xuat();
System.out.println("Ma nhan vien: "+maNV);
System.out.println("Ngay vao lam: "+ngayVL);
System.out.println("Luong can ban: "+luong);
}
public String loaiNV()
{
return "";
}
abstract public void nhapLuong();
abstract public long luong();
}
Class phong
import java.util.Scanner;
public class Phong {
public String soPhong;
public String lau;
public String loaiPhong;
public long gia;
public String thue;
public Phong(){
;
;
;
gia=0;
;
}
public Phong(Phong a) {
this.soPhong=a.soPhong;
this.lau=a.lau;
this.loaiPhong=a.loaiPhong;
this.gia=a.gia;
this.thue=a.thue;
}
public void nhap() {
Scanner sc=new Scanner(System.in);
System.out.println("Nhap so phong: ");
soPhong=sc.nextLine();
System.out.println("Nhap lau thu: ");
lau=sc.nextLine();
System.out.println("Nhap loai phong (VIP,thuong): ");
loaiPhong=sc.nextLine();
System.out.println("Nhap gia phong (1 ngay): ");
gia=sc.nextLong();
sc.nextLine();
System.out.println("Thue (chua thue,da thue): ");
thue=sc.nextLine();
}
public void xuat() {
System.out.println("So phong: "+soPhong);
System.out.println("Lau thu: "+lau);
System.out.println("Loai phong: "+loaiPhong);
System.out.println("Gia phong(1 ngay): "+gia);
System.out.println("Phong: "+thue);
}
}
Class Quan ly
import java.util.Scanner;
public class QuanLy{
NhanVien dsNV[];
KhachHang dsKH[];
Phong dsP[];
int soNV;
int soKH;
int soP;
Scanner sc= new Scanner(System.in);
public QuanLy(int m) {
dsNV= new NhanVien[m];
dsKH= new KhachHang[m];
dsP= new Phong[m];
}
public void hienThiDSNV(){
for(int i=0; i<soNV; i++) {
this.dsNV[i].xuat();
System.out.println("Tong tien luong: "+dsNV[i].luong());
System.out.println();
}
}
public void hienThiDSKH(){
for(int i=0; i<soKH; i++) {
this.dsKH[i].xuat();
System.out.println();
}
}
public void hienThiDSP(){
for(int i=0; i<soP; i++) {
this.dsP[i].xuat();
System.out.println();
}
}
public void timNV(String manv){
for(int i=0; i<soNV; i++)
if(dsNV[i].maNV.equals(manv))
dsNV[i].xuat();
}
public void timKH(String makh) {
for(int i=0; i< soKH; i++)
if(dsKH[i].maKH.equals(makh))
dsKH[i].xuat();
}
public void timP(String sophong){
for(int i=0; i<soP; i++)
if(dsP[i].soPhong.equals(sophong))
dsP[i].xuat();
}
public void them(KhachHang t) {
t.nhap();
this.dsKH[soKH]= t;
soKH= soKH+1;
}
public void them(NhanVien t) {
t.nhap();
this.dsNV[soNV]= t;
soNV=soNV+1;
}
public void them(Phong t){
t.nhap();
this.dsP[soP]= t;
soP=soP+1;
}
}
Bạn đang đọc truyện trên: Truyen247.Pro