CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    6

    Can Anyone help Me, PLS!

    The program requires to build several classes which will put several items with different weights into the MINIMUM number of boxes. Each item will have 2 data - an identifier and a weight, W (0<W<=1£©.

    You are required to implement TWO (2) related strategies, and to compare the number of boxes used by each strategy for given set of items.

    Strategy 1:
    Arrange items into boxes.
    E.g. weights 0.4, 0.4, 0.6, 0.6 --> 2 boxes

    Strategy 2:
    Sort the items into decreasing order by weight first, then use Strategy 1.

    CLASSES GIVEN:
    --------------
    BinaryHeap.java
    PriorityQueue.java
    UnderFlowException.java

    CLASSES NEED TO BUILD:
    --------------------------
    1. Item class
    - a constructor of Item containing an integer identifier and a double weight
    - this constructor only allows weight W (0<W<=1)
    - throw an exception if constructor passes a bad weight (e.g. W>1 or W<0)
    - methods to return items identifier and weight
    - a toString method to return a left bracket, identifier, a comma, a space, a weight and
    a right bracket (e.g. "(2, 0.359)")
    2. Box class
    - start counting at 1.0
    - list of item object in the box
    - a method to return the weight can be added, already added, number of items in the box,
    the i-th item in the box (throw exception if i is invalid), list of all items in the box
    - toString method contains weight available, weight of items in box, number of items in the
    box, list of items in the box
    - implement this class with Comparable interface - compare two boxes, compare the weight of
    items to pack into boxes, and should return the list of packed boxes
    3. Strategy class
    - contains Strategy 1 method and Strategy 2 method
    - first implement Strategy 1, then implement Strategy 2
    - each method accept only a parameter of list of items to pack into boxes and return the
    list of packed boxes
    4. Test class
    - contains the main method
    - opens a text file containing a single line with a list of items weights
    (i.e. 0.3, 0.249, 0.95, 0.34, 0.21, 0.13, 0.79, 0.2, 0.86)
    - creates a list of items
    - calls each methods for Strategy 1 and 2
    - prints out the resulting list of boxes of each call

    SOS~Can anyone help me to finish this program? Thanks a lot!
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 1999
    Posts
    126
    Come on!
    We are glad to help, but we don't do your homework!
    What do you think you'll learn if we are doing your work?
    So. you should at least try to do it yourself. If you are running into problems, you are welcome to ask questions here.


    Timo

  3. #3
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    6
    I'm the beginner of the Java , actuality it's quite hard for me. The due day it's tomorrow, so i'm very worried about it.

    I also want to improve my programme skill,thanks.

  4. #4
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    6
    Can U help me this time?

  5. #5
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    137
    Arj,
    Have you tried these web-sites:

    http://www.hotdispatch.com

    http://www.helpshare.com

    http://www.experts-exchange.com

    Good Luck,
    Avi.

  6. #6
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    6
    Thanks,abramia
    I've tried, but still no get any reply yet

  7. #7
    Join Date
    Jan 2002
    Location
    Halifax, NS, Canada
    Posts
    985
    I'm the beginner of the Java , actuality it's quite hard for me. The due day it's tomorrow, so i'm very worried about it.

    I also want to improve my programme skill,thanks.
    How are you going to improve your skills if someone else does it for you?

    If you have a specific question, we'd be glad to help. I suggest doing a search on google for some good tutorials.

  8. #8
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    6
    I'm taking two subjects in the summer semester, and it must be finished within one and half month. Our lecturers gives us quite a lot of assignments to do, i don't have enough time to finish all, so I come to ask for help.

  9. #9
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    Arj: If you want to get your project done, you'd better start doing it. Ask as many sensible questions as you like, but bear in mind we aren't a free coding service and we're not a substitute for reading the Java docs.

    There's no cure for birth and death save to enjoy the interval
    Please use &#91;CODE]...your code here...&#91;/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured