?? mfindbynamecommand.java
字號:
package cmd;import core.*;import db.*;import java.util.List;import javax.swing.JOptionPane;public class MFindByNameCommand extends MDatabaseCommand{ private static final String [] PARAM_NAMES = { "first", "last" }; private static final String [] PARAM_PROMPTS = { "Enter first name:", "Enter last name:" }; public MFindByNameCommand () throws java.io.IOException { super (); } public String [] getParameterNames () { return PARAM_NAMES; } public String [] getParameterPrompts () { return PARAM_PROMPTS; } protected void executeDatabaseCommand (HotelDB database) { String first = getParameter ("first"); String last = getParameter ("last"); List reservations = database.getReservations (last, first); displayResults ("Reservations for " + first + " " + last, reservations); } protected void displayResultsText (String title, List reservations) { System.out.println (title); if (reservations.size() > 0) DBUtilities.displayReservations (reservations); else System.out.println ("No reservations for: " + getParameter ("first") + " " + getParameter ("last")); } public String getMenuName () { return "Find By Name..."; } public String getName () { return "name"; } public String getDescription () { return "Finds a reservation by customer name"; } public Command makeInstance () { try { return new MFindByNameCommand (); } catch (java.io.IOException e) { return null; } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -