Subscribe to RSS feed

Sticky post

Forever and one



Mình thực sự là không thích Rock nhưng nghe bài này thấy hay quá nên post lên 
cho mọi người cùng nghe.
FOREVER AND ONE What can I do?
Will I be getting through?
Now that I must try
to leave it all behind

Did you see
What you have done to me
So hard to justify
Slowly is passing by

Forever and one
I will miss you
However, I kiss you
yet again
Way down in Neverland
So hard I was triyng
Tomorrow I'll still be crying
How could you hide
your lies, your lies

Here I am
Seeing you once again
My mind's so far away
My heart's so close
to stay
Too proud to fight
I'm walking back into night
Will I ever find
Someone to believe?

Forever and one
I will miss you
However, I kiss you
yet again
Way down in Neverland
So hard I was trying
Tomorrow I'll still be crying
How could you hide your lies
your lies

Bài toán thuế thu nhập (sử dụng nhập xuất)

// Hoang Lang. Lop 08LTT. MSV: 082250531110
import java.util.*;
import java.io.*;

class NguoiNopThue extends ConNguoi
{	
	public static NhapXuat x = new NhapXuat();
	public ThuNhap[] cacKhoanThu;
	public ConCai[] cacCon;
	public BoMe bo;
	public BoMe me;
		
	public NguoiNopThue()
		{}
		
	public void nhapThongTin() throws Exception
		{	
			this.hoTen=x.docChuoi("Ho ten ");
			this.namSinh=x.docSoNguyen("Nam sinh ");
			int a = x.docSoNguyen("Gioi tinh (nam 0 nu 1)");
			if(a==0 | a==1)
				{
					this.gioiTinh = a;
				}
			else
				{
					System.out.println("Nhap sai, yeu cau nhap lai!");
					this.nhapThongTin();
				}
		} // ham override
		
	public void nhapCacKhoanThuNhap() throws Exception
		{	
			System.out.println("\nNHAP THONG TIN CAC KHOAN THU NHAP");
			int soTN = x.docSoNguyen("Co bao nhieu khoan thu nhap ?");
			cacKhoanThu = new ThuNhap[soTN];
			for (int i=0; i<cacKhoanThu.length; i++)
				{	
					ThuNhap a = new ThuNhap();
					System.out.println("Khoan thu nhap thu "+(i+1));
					a.nhapThongTin();
					this.cacKhoanThu=a;
}
}

public void nhapThongTinBoMe() throws Exception
{
System.out.println("\nNHAP THONG TIN BO ME");
int i = x.docSoNguyen("(con bo me nhap 2, con bo hoac me nhap 1, deu mat nhap 0) ?");
switch (i)
{
case 2:
{
System.out.println("Nhap thong tin bo:");
BoMe x = new BoMe();
x.nhapThongTin();
this.bo = x;
System.out.println("Nhap thong tin me:");
BoMe y = new BoMe();
y.nhapThongTin();
this.me = y;
break;
}

case 1:
{
int ii = x.docSoNguyen("Con bo hay con me? Bo nhap 0, Me nhap 1");
switch(ii)
{
case 0:
{
System.out.println("Nhap thong tin bo:");
BoMe y = new BoMe();
y.nhapThongTin();
this.bo = y;
break;
}
case 1:
{
System.out.println("Nhap thong tin me:");
BoMe z = new BoMe();
z.nhapThongTin();
this.me = z;
break;
}
default:
{
System.out.println("Yeu cau nhap dung theo dieu kien de ra");
this.nhapThongTinBoMe();
break;
}
}

break;
}

case 0:
{
break;
}

default:
{
this.nhapThongTinBoMe();
}
}
}

public void nhapThongTinAnhChiEm() throws Exception
{
if((this.bo!=null)|(this.me!=null))
{
System.out.println("\nNHAP THONG TIN ANH CHI EM - CHI NHUNG NGUOI CO THU NHAP");
System.out.print("Co bao nhieu anh chi em?");
if (this.me!=null && this.bo!=null)
{
this.me.nhapThongTinConCai();
this.bo.cacCon = this.me.cacCon;
}
else
{
if(this.me!=null)
this.me.nhapThongTinConCai();
else
this.bo.nhapThongTinConCai();
}
}
}

public void nhapThongTinConCai() throws Exception
{
System.out.println("\nNHAP THONG TIN CON CAI");
int soCC = x.docSoNguyen("Co bao nhieu con");
this.cacCon = new ConCai[soCC];
for (int i =0; i<this.cacCon.length; i++)
{
ConCai a = new ConCai();
a.nhapThongTin();
this.cacCon
= a;
}
}

void khaiBaoThongTin() throws Exception
{
System.out.println("\nNHAP THONG TIN CA NHAN NGUOI NOP THUE");
this.nhapThongTin();
this.nhapCacKhoanThuNhap();
this.nhapThongTinBoMe();
this.nhapThongTinAnhChiEm();
this.nhapThongTinConCai();
this.x.dongNhapXuat();
}

public double tinhMucKhauTru()
{
return 4000000;
} //ham override

double tinhKhauTruNuoiCon()
{
double khauTruCon = 0;
if (this.cacCon!=null)
{
for (int i=0; i<this.cacCon.length; i++)
{
khauTruCon = khauTruCon + this.cacCon
.tinhMucKhauTru();
if (khauTruCon>3200000) khauTruCon = 3200000;
}
}
return khauTruCon;
}

double tinhKhauTruNuoiBoMe()
{
int dem =1;
int tam = 0;
double khauTruBoMe =0;
// dem so con co thu nhap tren 4trieu
if((this.bo!=null)|(this.me!=null))
{
if(this.bo!=null)
{
if(this.bo.cacCon!=null)
{
tam = this.bo.cacCon.length;
for(int i =0; i<tam; i++)
{
if(this.bo.cacCon
.tinhTongThuNhap()>4000000) dem++;
}
}
}

else
{
if(this.me.cacCon!=null)
{
tam = this.me.cacCon.length;
for(int i =0; i<tam; i++)
{
if(this.me.cacCon
.tinhTongThuNhap()>4000000) dem++;
}
}
}
}
if((this.bo==null)&&(this.me==null)) return 0;
if((this.bo!=null)&&(this.me==null)) khauTruBoMe = this.bo.tinhMucKhauTru()/dem;
if((this.bo==null)&&(this.me!=null)) khauTruBoMe = this.me.tinhMucKhauTru()/dem;
if((this.bo!=null)&&(this.me!=null)) khauTruBoMe = (this.bo.tinhMucKhauTru() + this.me.tinhMucKhauTru())/dem;
return khauTruBoMe;
}

double tinhKhauTruGiaCanh()
{
double khauTruGiaCanh = 0;
khauTruGiaCanh = this.tinhKhauTruNuoiBoMe() + this.tinhKhauTruNuoiCon() + this.tinhMucKhauTru();
return khauTruGiaCanh;
}

public double tinhTongThuNhap()
{
double tongThuNhap = 0;
for (int i=0; i<this.cacKhoanThu.length; i++)
{
tongThuNhap = tongThuNhap + this.cacKhoanThu
.mucThu;
}
return tongThuNhap;
} //ham override

public int tinhLaiSuat(double x)
{
int phanTramThue = 5;
for (double i = x; i>=3000000;)
{
phanTramThue += 1;
i = i - 1000000;
}
return phanTramThue;
}

double tinhThuNhapChiuThue()
{
return this.tinhTongThuNhap() - this.tinhKhauTruGiaCanh();
}

double tinhThuePhaiNop()
{
double thuePhaiNop = 0;
thuePhaiNop = ((this.tinhThuNhapChiuThue()*tinhLaiSuat(this.tinhThuNhapChiuThue()))/100);
return thuePhaiNop;
}

public void xuatDanhSachThuNhap()
{
System.out.println("Danh sach cac khoan thu nhap: \n");
for (int i =0; i<this.cacKhoanThu.length; i++)
{
System.out.println("\t" + (i+1) + ". " + this.cacKhoanThu
.khoanThu + " : " + this.cacKhoanThu.mucThu);
}
}

public void xuatCacKhoanKhauTru()
{
System.out.println("\tTong thu nhap la: " + this.tinhTongThuNhap() + "\n\n");
System.out.println("Khau tru nuoi bo me la: " + this.tinhKhauTruNuoiBoMe());
System.out.println("Khau tru nuoi con la: " + this.tinhKhauTruNuoiCon());
System.out.println("Khau tru ban than la: " + this.tinhMucKhauTru());
System.out.println("Tong cong cac khoan khau tru la: " + this.tinhKhauTruGiaCanh() + "\n\n");
}

public void baoCaoKetQua()
{
if(this.tinhThuNhapChiuThue()>0)
{
System.out.println(" \nHOA DON DONG THUE\n\n ");
System.out.println(this);
this.xuatDanhSachThuNhap();
this.xuatCacKhoanKhauTru();
System.out.println("Thu nhap chiu thue la: " + this.tinhThuNhapChiuThue());
System.out.println("Thue suat la: " + this.tinhLaiSuat(this.tinhThuNhapChiuThue()) + "% \n\n");
System.out.println("Tong so tien thue phai dong la: " + this.tinhThuePhaiNop());
}
else
{
System.out.println("\nNGUOI NAY KHONG PHAI DONG THUE");
}
}

public static void main(String [] ds) throws Exception
{
NguoiNopThue a = new NguoiNopThue();
a.khaiBaoThongTin();
a.baoCaoKetQua();
}
}

class BoMe extends ConNguoi
{
ConNguoi[] cacCon = new ConNguoi[10];
NhapXuat x = new NhapXuat();

public BoMe()
{}

public void nhapThongTin() throws Exception
{
this.hoTen=x.docChuoi("Ho ten ");
this.namSinh=x.docSoNguyen("Nam sinh ");
this.gioiTinh=x.docSoNguyen("Gioi tinh (nam 0 nu 1)");
} // ham override

public void nhapThongTinConCai() throws Exception
{
int soCon = x.docSoNguyen(" ");
if (soCon>0)
{
this.cacCon = new ConNguoi[soCon];
for(int i =0; i<this.cacCon.length; i++)
{
NguoiNopThue a = new NguoiNopThue();
System.out.println("\nNguoi thu "+(i+1));
a.nhapThongTin();
a.nhapCacKhoanThuNhap();
this.cacCon
= a;
}
}
else
{
this.cacCon=null;
}
}

public double tinhMucKhauTru()
{
if ((this.tinhTuoi()>=60 & gioiTinh==0) | (this.tinhTuoi()>=55 & gioiTinh == 1))
return 1600000;
else
return 0;
} // ham override

public String toString()
{
return super.toString();
} // ham override
}

class ConCai extends ConNguoi
{
int diHoc;
NhapXuat x = new NhapXuat();

public ConCai()
{}

public void nhapThongTin() throws Exception
{
this.hoTen=x.docChuoi("Nhap ho ten ");
this.namSinh=x.docSoNguyen("Nhap nam sinh ");
this.gioiTinh=x.docSoNguyen("Nhap gioi tinh (nam 0 nu 1)");
this.diHoc = x.docSoNguyen("Hoc lop: (neu da nghi hoc nhap 0)" );
} // ham override

public double tinhMucKhauTru()
{
if ((this.diHoc!=0) && (this.tinhTuoi()< 18)) return 1600000; else return 0;
} // ham override

public String toString()
{
return "Ho ten:\t" + this.hoTen + "\nNam sinh:\t" + this.namSinh + "\nGioi tinh:\t" + this.xemGioiTinh() + "\nDi hoc:\t" + this.diHoc + "\n";
} // ham override
}

class ConNguoi
{
String hoTen;
int namSinh;
int gioiTinh;
NhapXuat x = new NhapXuat();

public ConNguoi()
{}

public void nhapThongTin() throws Exception
{
this.hoTen=x.docChuoi("Nhap ho ten ");
this.namSinh=x.docSoNguyen("Nhap nam sinh ");
this.gioiTinh=x.docSoNguyen("Nhap gioi tinh (nam 0 nu 1)");
}

public double tinhMucKhauTru()
{
return 0;
}

public double tinhTongThuNhap()
{
return 0;
}

public int tinhTuoi()
{
Date d = new Date();
return d.getYear()+1900 - this.namSinh;
}

public String xemGioiTinh()
{
if(this.gioiTinh==0) return "Nam"; else return "Nu";
}

public String toString()
{
return "Ho ten:\t" + this.hoTen + "\nNam sinh:\t" + this.namSinh + "\nGioi tinh:\t" + this.xemGioiTinh() + "\n";
}
}

class ThuNhap
{
String khoanThu;
double mucThu;
NhapXuat x = new NhapXuat();

public ThuNhap()
{}

public void nhapThongTin() throws Exception
{
this.khoanThu = x.docChuoi(" Ten khoan thu ");
this.mucThu = x.docSoThuc(" Muc thu ");
}

}

class NhapXuat
{
public static BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
public int a;
public double b;
public String st;
public int docSoNguyen(String inform) throws Exception
{
try
{
System.out.print(inform + ":\t");
this.a = Integer.parseInt(x.readLine());
}
catch(Exception x)
{
docSoNguyen("Nhap sai dinh dang, nhap lai !");
}
return this.a;
}

public double docSoThuc(String inform) throws Exception
{
try
{
System.out.print(inform + ":\t");
this.b = Double.parseDouble(x.readLine());
}

catch(Exception x)
{
docSoNguyen("Nhap sai dinh dang, nhap lai !");
}
return this.b;
}

public String docChuoi(String inform) throws Exception
{
System.out.print(inform + ":\t");
this.st = x.readLine();
return this.st;
}

public void dongNhapXuat() throws Exception
{
x.close();
}
}

Những chàng trai xấu tính - N.N.Ánh

Phần I

Phần II

Phần III

Phần IV

Phần V

Phần VI