Anda di halaman 1dari 2

1. Assignment 6: - Bi ny s dng 3 packages. Trc tin ta to trong th mc JBE_Assigment\src 3 th mc con l music, movies v customer.

- To ln lc cc lp sau nm trong cc package tng ng. Lu khi m mi file ti dng package: chn tn th mc tng ng to. o CompactDisc.class trong package music v movies. o CDCreator.class trong package customer. o UserInterface.class trong package customer. - Ni dung cc lp nh sau:
CompactDisc.class trong musicpublic String Title, Artist;
public int Code; public double Price; //Hm d ng public CompactDisk(String Title, String Artist, int Code, double Price){ this.Title = Title; this.Artist = Artist; this.Price = Price; this.Code = Code; } }

CompactDisc.class trong moviespublic String Title;


public int Code; public double Price; //Hm d ng public CompactDisk(String Title, int Code, double Price){ this.Title = Title; this.Price = Price; this.Code = Code;

CDCreadtor.class trong customerpublic music.CompactDisk[]


cd;

UserInterface.class trong customer


//Hm main

public movies.CompactDisk[] vcd; public int nextAlbum, nextAlbumCode; public int nextMovie,nextMovieCode;
//Hm d ng public CDCreator(){ nextMovieCode = 5; nextAlbumCode=5;

public arg){

static void main(String[]

CDCreator obj = new CDCreator(); byte choice=5; Scanner input = new Scanner(System.in);

nextMovie = 0; nextAlbum = 0;

//T o th c n sau Add a new music CD Add a new movie CD Display all music CDs Display all movie CDs Exit //S d ng c u trc switch ...case trn bi n choice g i l n l t cc ph ng th c t ng ng v i cc c ch n. }

cd = new music.CompactDisk[nextAlbumCode]; vcd = new movies.CompactDisk[nextMovieCode];

} //------public addMusicCD(){

String tieude, nghesi; int MaCD; double gia; byte tiep; //i u khi n vng l p //s d ng while nh p nhi u a vo cc bi n trn. while (nextAlbum < nextAlbumCode) //Sau khi nh p xong 1 a h i ng i dng ti p t c n a khng. N u ti p th l u l i vo m ng v tng nextAlbum. cd[nextAlbum++] = new music.CompactDisk(tieude, nghesi, maCD,gia);

- Shift_F6: Chy th chng trnh.


} //------public displayAllMusic(){

//s d ng vng l p for duy t qua cc ph n t c a m ng cd. M i a in trn 1 dng. for (i=0; i<=nextAlbum; i++){

Anda mungkin juga menyukai