Search:

Type: Posts; User: EDale

Search: Search took 0.10 seconds.

  1. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    Thank you very much sir, I was able to figure it out. The final thing I need to do is write the method for public void update(java.lang.String name, int quantity) but I think I can do it. I...
  2. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    So p's toString() is being called and I'm assuming that's the one I want to print. But I think the toString is being printed from LineItem too... I was instructed to create a toString for LineItem to...
  3. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    I realized by creating the collection in addToInvoice was creating a new collection every time addToInvoice is called. So I updated these two methods to:


    public Invoice() {
    ...
  4. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    Oh I see what you mean about not having an active console. It looks like to me yours output is right.. Could you guide me on what to do next?

    --- Update ---

    Okay I tried only doing one product...
  5. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    --- Update ---

    [/COLOR]I think the reason it is skipping position zero has something to do with this method:


    public void addToInvoice(LineItem item) {
    collection=new LineItem[5];...
  6. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    The only import statements I was given to use are


    import java.text.*; // for NumberFormat
    import java.util.*; // for Locale

    in the product class and


    import java.util.Scanner;
  7. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    The first position in the collection is giving me the null value.

    I'm sorry, I don't quite understand everything in Java programming enough to figure out without a general example, and just...
  8. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    Okay so for the last 3 spots giving null, I changed my method's for loop to only print as many items as I have put in by switching my code to


    public void print() {
    for (int i=0;...
  9. Replies
    18
    Views
    1,464

    Re: URGENT! Why won't my addToInvoice method work?

    The println() statement is printing the collection at all 5 positions. The last 3 positions have nothing in them so I think that's why I'm getting null. I don't know if I declared the array correctly...
  10. Replies
    18
    Views
    1,464

    URGENT! Why won't my addToInvoice method work?

    Hey guys,
    I'm working on arrays and I'm just not getting the hang of it. Every time my addToInvoice method is called and printed, it's not coming out correctly. Here's what the output is supposed to...
Results 1 to 10 of 10