asian xxx

/*

 * To change this template, choose Tools | Templates

 * and open the template in the editor.

 */

package kiemtra;

import java.util.*;

import java.io.*;

class Nguoi implements Serializable{

    //

String ht;

String dc;

}

class CongNhan implements Serializable{

String ma_cn;

String ca_sx;

Nguoi person = new Nguoi();

public void nhap(){

Scanner in=new Scanner(System.in);

System.out.print("Ma : ");ma_cn=in.nextLine();

System.out.print("Ten : ");person.ht=in.nextLine();

System.out.print("Dia chi : ");person.dc=in.nextLine();

System.out.print("Ca san xuat : ");ca_sx=in.nextLine();

}

public void xuat(){

System.out.println ("Ma CN = "+ma_cn);

System.out.println ("Ten CN = "+person.ht);

System.out.println ("Dia chi = "+person.dc);

System.out.println ("Ca SX = "+ca_sx);

}

}

class SanPham implements Serializable{

String ma_sp;

String ten;

double don_gia;

public void nhap(){

Scanner in=new Scanner(System.in);

System.out.print("Ma SP : ");ma_sp=in.nextLine();

System.out.print("Ten SP : ");ten=in.nextLine();

System.out.print("Don gia : ");don_gia=in.nextDouble();

}

public void xuat(){

System.out.println ("Ma SP = "+ma_sp);

System.out.println ("Ten SP = "+ten);

System.out.println ("Don gia = "+don_gia);

}

}

class BangTC implements Serializable{

Nguoi p;

CongNhan cn;

int sl_sp;

String ma_tmp[] = new String[1000];

SanPham arr_sp[] = new SanPham[1000];

int sl_msp[]=new int[1000];

public void input(CongNhan a,SanPham sp[]){

for(int i=0;i<arr_sp.length;i++){

arr_sp[i]=new SanPham();

}

Scanner in = new Scanner(System.in);

cn=a;

System.out.println ("Lap bang tinh cong cho cong nhan "+cn.person.ht+" Ma "+cn.ma_cn);

System.out.println ("Nhap tong so san pham cong nhan nay lam : ");sl_sp=in.nextInt();

for(int i=0;i<sl_sp;i++){

System.out.println ("Nhap ma cua san pham thu "+(i+1)+" : ");in.nextLine();ma_tmp[i]=in.nextLine();

for(int z=0;z<2;z++){

if(ma_tmp[i].equals(sp[z].ma_sp)) {

arr_sp[i]=sp[z];

}

}

System.out.println ("Nhap so luong san pham nay ma cong nhan lam duoc : ");sl_msp[i]=in.nextInt();

}

}

public void show(){

System.out.println ("Cong Nhan "+cn.person.ht);

for(int i=0;i<sl_sp;i++){

System.out.format ("%1$-5s %2$-10s %3$-20s %4$-10s",(i+1),arr_sp[i].ma_sp,arr_sp[i].ten,sl_msp[i]);

System.out.print ("

");

}

}

}

class MainPro{

public static void main(String a[]) throws IOException,ClassNotFoundException{

//SanPham sp = new SanPham();

Scanner in = new Scanner(System.in);

System.out.println ("NHAP THONG TIN CONG NHAN ");

ObjectOutputStream obj = new ObjectOutputStream(new FileOutputStream("CN.DAT"));

for(int i=0;i<2;i++){

CongNhan cn=new CongNhan();

cn.nhap();

obj.writeObject(cn);

}

CongNhan cn_new[]=new CongNhan[2];

for(int i=0;i<cn_new.length;i++){

cn_new[i]=new CongNhan();

}

System.out.println ("IN THONG TIN CONG NHAN ");

ObjectInputStream in_obj = new ObjectInputStream(new FileInputStream("CN.DAT"));

for(int i=0;i<2;i++){

CongNhan cn ;

cn = (CongNhan)in_obj.readObject();

cn_new[i]=cn;

cn.xuat();

}

System.out.println ("NHAP THONG TIN SAN PHAM ");

ObjectOutputStream obj1 = new ObjectOutputStream(new FileOutputStream("SP.DAT"));

for(int i=0;i<2;i++){

SanPham sp = new SanPham();

sp.nhap();

obj1.writeObject(sp);

}

SanPham sp_new[] = new SanPham[2];

for(int i=0;i<2;i++){

sp_new[i]=new SanPham();

}

System.out.println ("IN THONG TIN SAN PHAM ");

ObjectInputStream in_obj1 = new ObjectInputStream(new FileInputStream("SP.DAT"));

SanPham sp;

for(int i=0;i<2;i++){

sp = (SanPham)in_obj1.readObject();

sp_new[i]=sp;

sp.xuat();

}

System.out.println ("NHAP THONG TIN CHO BANG TINH CONG ");

ObjectOutputStream ob2 = new ObjectOutputStream(new FileOutputStream("BANGTC.DAT"));

BangTC bang;

for(int i=0;i<2;i++){

bang = new BangTC();

bang.input(cn_new[i],sp_new);

ob2.writeObject(bang);

}

System.out.println ("IN THONG TIN BANG TINH CONG ");

ObjectInputStream in_obj2 = new ObjectInputStream(new FileInputStream("BANGTC.DAT"));

BangTC bang_new[] = new BangTC[2];

for(int i=0;i<2;i++){

bang_new[i]=new BangTC();

}

BangTC bangTC1;

for(int i=0;i<2;i++){

bangTC1 =(BangTC)in_obj2.readObject();

bangTC1.show();

}

}

}

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: #cst