Facebook Sharer
选择您要替换的背景颜色:
【农历新年】背景图片:
个性化设定
 注册  找回密码
查看: 2085|回复: 3
打印 上一主题 下一主题

java编程 求助

[复制链接]

8

主题

0

好友

36

积分

初级会员

Rank: 1

跳转到指定楼层
1#
发表于 2010-3-7 01:55 AM |只看该作者 |倒序浏览
初学java  ,半路加入java班, 对java了解不好。
作业不太会写,请高手帮忙。  谢谢!!!作业只给出了interface(见下面),要求copy the contents of the Management interface into the Department class,就是再新建的Department class中 写方法(我是怎么理解的)。请给出methods。




public interface Management
{
   
    /**Returns 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
     **/
     
     
     
    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);


}



问题补充:
customers 包括student and staff
要求有name和 (Employee/Student no.)




收藏收藏0

7

主题

1

好友

5108

积分

一流名嘴

Rank: 12Rank: 12Rank: 12

2#
发表于 2010-3-7 04:53 PM |只看该作者
原帖由 Xis 于 2010-3-7 01:55 AM 发表
初学java  ,半路加入java班, 对java了解不好。
作业不太会写,请高手帮忙。  谢谢!!!作业只给出了interface(见下面),要求copy the contents of the Management interface into the Department class,就 ...


之前一篇別人提供的意見都沒法接受的話, 那麼之能等待好心人幫你超渡了
http://java.sun.com/docs/books/tutorial/java/IandI/createinterface.html


回复

使用道具 举报

46

主题

6

好友

6456

积分

百变名嘴

Rank: 13Rank: 13Rank: 13Rank: 13

3#
发表于 2010-3-7 04:53 PM |只看该作者

回复 #1 Xis 的帖子

http://java.sun.com/developer/on ... ramming/BasicJava1/

楼主。说真的。你还是自己做的好。 确实你现在过得了现在 assignment, 不代表你以后的科目能够过得顺利。 或以后的工作也会顺利。 大家都是过来人。 都是从不懂慢慢才看得懂一点的。

现在学还来得及。LINK 给了你。
如果懒惰, 请直接看 Fields and Methods。



em0009


回复

使用道具 举报

0

主题

0

好友

18

积分

初级会员

Rank: 1

4#
发表于 2010-3-11 02:44 PM |只看该作者
空想象和等待永远也学不会啊。开始了你就有头绪应该入手或应该学什么。遇到了问题才请教别人啊


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2024-6-16 05:44 PM , Processed in 0.113034 second(s), 27 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

Ultra High-performance Dedicated Server powered by iCore Technology Sdn. Bhd.
Domain Registration | Web Hosting | Email Hosting | Forum Hosting | ECShop Hosting | Dedicated Server | Colocation Services
本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved
合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部