- 分享
- 0
- 人气
- 0
- 主题
- 8
- 帖子
- 828
- UID
- 213565
- 积分
- 36
- 阅读权限
- 11
- 注册时间
- 2009-4-1
- 最后登录
- 2011-2-10
- 在线时间
- 455 小时
|
请大家帮我看看怎么编,如何下手。
十分感谢,如果大家可以帮忙。
public class Department
{
/**Returns the location of the department as a String
* @return the location of the department as a String
**/
public String getSite();
/**Returns a String representation of the department,including
* its location and all its copiers
* @return a String representation of the department,including
* its location and all its copiers
**/
public String toString();
/**Returns a String representation of the customers who have used the
* department's services
* @return a String representation of the customers who have used the
* department's services
**/
public String getAllCustomers();
// ***************** Copiers ************************
/** Allows a laser copier to be added to the department.The maximum
* number of copies which can be done in one request for a laser
* copier is 20.The copier's availability is set to "available"
* @param reg represents the depratmental code of the copier
**/
public void addCopier(String id);
/** Allows a colour copier to be added to the department.The maximum
* number of copies which can be done in one request for a colour
* copier is 10.The copier's availability is set to "available"
* @param reg represents the departmental code of the copier
* @param photo is true if the copier can produce "photo quality" prints
**/
public void addCopier(String id, boolean photo);
/** Allows a plain paper copier to be added to the department. The
* maximum number of copies allowed in one request is set from the
* parameter value.The copier's availability is set to "available"
* @param id represents the departmental identifier of the copier
* @param max gives the maximum number of copies allowed in one request
* @param make gives the copier's manufacturer
**/
public void addCopier(String id,int max, String make);
/** Sets the contact details for the repair technician of a copier, but is
* only used for plain paper copiers
* @param id represents the departmental identifier of the copier
* @param details gives the contact details for the repair technician
*/
public void setContactDetails(String id, String details);
/** Returns a String representation of all the copiers
* @return returns a String representation of all copiers
**/
public String getAllCopiers();
/** Returns true if the copier with the departmental identifier
* can be found in the system, false otherwise.
* @param depId represents the departmental identifier of the copier
* @return returns true if the copier with the departmental identifier
* can be found, false otherwise.
**/
public boolean isCopier(String depId);
/** Removes a copier from the department. pre-condition: isCopier(depId)
* @param depId represents the departmental identifier of the copier
**/
public void removeCopier(String depId);
//**************************************************************
/** Adds a request to the request list if it is possible.Requests for more than
* 20 copies which require either high quality or colour are not
* possible.If not possible "Request not possible" is returned.Requests
* which are possible are number sequentially from 100 and the
* customer added to a set of customers.If a suitable copier is
* available,the state of the request is set to "printing",the selected
* copier is added to the request and the copier's state is set to "in
* use".If a copier is not available, request's state is set to "waiting".If
* a suitable copier cannot be found,"Request waiting" is returned,
* other wise "Request ready for printing on:" with the copier details.
* @cust is the name of the customer
* @staff indicates whether the customer is a member of staff
* @number is either department number if staff, or student number,if student
* @pages is the number of pages in the documents
* @copies is the number of copies required
* @param col indicates whether colour is required
* @param hQuality indicates whether high quality is required
* @param dsided indicates whether double-sided is required
* @return returns "Request not possible"if the request is not possible,
* "Request waiting" if no copier is available, else "Request ready for
* printing on:" together with the copier details
**/
public String addRequest(String cust,boolean staff,int number,int pages,
int copies, boolean hQuality, boolean col, boolean dsided);
/** Provides a String representation of all requests
* @return returns a String representation of of all requests
**/
public String getAllRequests();
/** Provides a String representation of all requests which are
* still waiting for printing
* @return returns a String representation of all requests which are
* still waiting for printing
**/
public String getRequestsWaiting();
/** records that the request specified by the parameter value has been
* done.If the request cannot be found return -1.If the request can be
* found,the state of the request is set to "done" ,the state of its
* copier is set to "available" and 0 is returned.
**/
public int setRequestDone(int jNo);
/** Returns the cost of request specified by the parameter value once a
* has been printed.If the request cannot be found or the printing has
* not been done return -1.Copies printed on colour copiers are charged
* at 15p per copy per page.A laser printed copy costs 6p per copy per
* page (whether double-sided or not)and plain paper copy 4p per copy per
* page,unless the printing is double-sided in which case the cost is
* 3p per copy per page.There is a set up cost of � per request with an
* additional single cost of � for colour.
*
* @param requestNo is the number of the request
* @return the cost of a request calculated as described above
**/
public double getRequestCost(int jNo);
/** Checks the list of requests and returns the request number of the first
* request for which a printer is now available.If such a request is found,
* the state of the request is set to "printing", the selected copier is
* added to the request information and the copier's state is set to
* "in use"and the request number is returned.If there no such requests,
* return -1
**/
public int checkforRequestsWaiting();
// *************** file write/read *********************
// Methods required for Task 5 ONLY - not required for the demo
// If you do not implement these, just comment them out
/** Writes all requests to the specified file
* @param fname name of file storing requests
*/
public void writeRequestsToFile(String fname);
/** reads all requests from the specified file and stores
* @param fname name of file storing requests
*/
public void readRequestsFromFile(String fname);
/** reads data about copiers from a text file and stores in collection of
* copiers.Data in the file is "comma separated" and so editable
* @param fileName name of the file to be read
*/
public void initialiseCopiersFromFile(String fileName);
/** writes data about copiers to a text file from collection of
* copiers.Data in the file is to be "comma separated" and so editable
* @param fileName name of the file to which copiers are written
*/
public void saveCopiersToFile(String fileName);
} |
|