📄 bookstoremanifest.java
字号:
package tomato;
import java.util.*;
public class BookstoreManifest {
protected static Vector d_manifest = new Vector();
private static BookstoreManifest _instance;
private static BookstoreManifest Instance(){
if (_instance == null)
_instance = new BookstoreManifest();
return _instance;
}
protected BookstoreManifest(){
Location Chinapublocation = new Location(15,15);
Location dearBooklocation = new Location(10,20);
Location taobaolocation = new Location(21,14);
Bookstore Chinapub = new Bookstore((String)"Chinapub",Chinapublocation);
Bookstore dearBook = new Bookstore((String)"dearBook",dearBooklocation);
Bookstore taobao= new Bookstore((String)"taobao",taobaolocation);
Add(Chinapub);
Add(dearBook);
Add(taobao);
}
public static void Add( Bookstore bookstore ){
d_manifest.addElement( bookstore );
}
public static void Remove( Bookstore bookstore ){
d_manifest.removeElement(bookstore);
}
public static Bookstore SelectBookstore(int num){
return (Bookstore)d_manifest.elementAt(num);
}
public static void Display(){
for(int index = 0; index < d_manifest.size(); index++){
Bookstore bs = (Bookstore)d_manifest.elementAt(index);
System.out.print("The No."+(index+1)+" Bookstore :"+bs.GetBookstorename()+'\t');
bs.GetLocation().Display();
}
}
public static void main(String[]args){
BookstoreManifest aTest = new BookstoreManifest();
aTest.Display();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -