Lighting Store 500
Lighting Store 500
Title
Lighting store
Background
Write a program to manage a store that sells household lighting equipment. The program is
implemented object-oriented (design patterns can be applied).
Lamps are classified as follows: incandescent, fluorescent, and LED lamps.
5. Class Menu
public class Menu {
.....
public Menu() {
this.mainChoice = MenuItem.EXIT;
this.subChoice = MenuItem.BACK;
}
switch (item) {
case LAMP_FUNCTIONS:
menuOptions = Menu.lampSubOptions;
break;
case SALES_ FUNCTIONS:
menuOptions = Menu.salesSubOptions;
break;
case SEARCH_ FUNCTIONS:
menuOptions = Menu.searchSubOptions;
break;
case INVENTORY_ FUNCTIONS:
menuOptions = Menu.inventorySubOptions;
break;
case CUSTOMER_ FUNCTIONS:
menuOptions = Menu.customerSubOptions;
break;
case MANUFACTURER_ FUNCTIONS:
menuOptions = Menu.manufacturerSubOptions;
break;
default:
menuOptions = Menu.mainOptions;
}
return menuOptions;
}
6. Class main
private void process() {
Menu menu = new Menu();
MenuItem userChoice = null;
do {
userChoice = menu.getUserChoice();
switch (userChoice) {
case LAMP_ADD:
addNewLamp();
break;
case LAMP_UPDATE:
........
.......
default:
System.out.println("chưa cài đặt");
}
} while (userChoice != MenuItem.EXIT);
}
7. File database
File Customers.csv Description
C0001,Nguyễn Ngọc Nam,0909012345 Information in a line:
C0002,Trần Hoàng Hải,0916211022 <ID,Name,Phone number>
-----Hết-----