Search:

Type: Posts; User: MrPigeon

Search: Search took 0.27 seconds.

  1. Re: Reading data from a file and setting it to an array

    Sorry the delayed response, I've been pretty busy with work and studying for exams.

    Ah ok, I think I understand. I'll give it a go and let you know the results :)
  2. Re: Reading data from a file and setting it to an array

    Ah ok I understand now :) I have one slight problem though, how would I handle the store names (Lambton and Callaghan)?

    I need them to know which array to set the data to but it won't always be in...
  3. Re: Reading data from a file and setting it to an array

    It wouldn't be a uni assignment if it weren't unusual, unnecessary and complicating haha. So I tried what you suggested but I've obviously done something wrong. Here's what I got:




    private...
  4. Re: Reading data from a file and setting it to an array

    I provided one at the bottom of the first post. But here it is again:

    Lambton:

    Name: chocolate
    demand rate: 50
    setup cost: 200
    unit cost: 5.2
    inventory cost: 2
    selling price: 3
  5. Re: Reading data from a file and setting it to an array

    Ok, I have to go to work now but I'll take a look when I get home :)
  6. Re: Reading data from a file and setting it to an array

    Yeah that's the input file I'm trying to read to make sure it works. What would you suggest instead of nextInt()?

    Something like:



    stringDemand = inputStream.next();
    stringRate =...
  7. Re: Throw Error - simple code.....any advice appreciated!

    Hey, welcome to the forum, I hope you enjoy it here :)

    First I would suggest you learn to comment code correctly. You enclose it with [_code]Code Goes Here[/code_] just without the underscores....
  8. Re: Reading data from a file and setting it to an array

    Yes console is an instance of Scanner, sorry I didn't make that clear. It's declared at the start of the Interface class as it is used quite frequently in a number of different methods.
    Scanner...
  9. Reading data from a file and setting it to an array

    Hey guys. I can read the data to a monitor perfectly. But, I'm having problem reading data from an external file into an array of class objects.

    Here's my attempt at writing the method:

    ...
  10. Replies
    3
    Views
    73

    Re: Skipping else if statement

    Thank you so much for providing a fresh pair of eyes. I spent so much time looking at it I didn't even realise I was missing the curly braces.
  11. Replies
    3
    Views
    73

    Skipping else if statement

    Hey guys, I have two different Class object arrays storing 3 elements (2 Store arrays, both initialised to hold 3 Product objects). The problem is, I can set data to one array with no problem but my...
  12. Re: Using a mutator method to set data to an array element

    I'm trying to use the mutator method setName(String) to set the values of each element of an array. So the first string entered by the user would be assigned to product[0] and so on. On an earlier...
  13. Using a mutator method to set data to an array element

    Hey guys, the problem I'm having is I want to use a mutator method to set data for an array element. The code I have so far is:


    public void addProduct(String productName)
    //Goes through...
  14. Re: Using Accessor methods to access data from another class

    Thank you both for your helpful answers. And I agree, it was rather silly of me to ask a rather vague question without even a few comments in my code. I solved my problem as I had not declared the...
  15. [SOLVED] Why is my code storing input data in all three of my product objects?

    Hello,

    I have been trying to figure out this problem for the past day and yet every tweak I make I seem to mess it up even more. I should add that I am relatively new to java and programming in...
  16. Using Accessor methods to access data from another class

    I am relatively new to java and learning to program, this being my 8th week at uni. I have been fiddling around with my code for the past day and I have been searching for the past hour or two for a...
Results 1 to 16 of 16