Having trouble understanding/setting-up program...(Java related)

Sharky Forums


Results 1 to 4 of 4

Thread: Having trouble understanding/setting-up program...(Java related)

  1. #1
    Goldfish
    Join Date
    Dec 2002
    Location
    Washington, D.C.
    Posts
    81

    Having trouble understanding/setting-up program...(Java related)

    Yesterday, my professor gave us an extra credit assignment which is due on September 30, 2003. I'm having trouble getting a feel for what she is asking as well as how to go about coding the program. You can read the exact project assignment sheet HERE. I've just been staring at the assignment sheet for 20 minutes and haven't come up with anything. I'd greatly appreciate it if someone could point me in the right direction so I can get started and help me set-up the program.

    And please don't write the full program the program for me. Though a nice gesture, I would rather learn the art of JAVA programming than have someone do it for me while I don't learn a thing.
    Last edited by Cod; 09-23-2003 at 02:16 AM.

  2. #2
    NullPointerException rock's Avatar
    Join Date
    Sep 2000
    Location
    York, PA
    Posts
    6,203
    What part(s) are you having a problem with?

    It appears there are two bits - the reading of the input file and the computing of the solution.

    As for the file reading, a simple comma-separated-value file could be read pretty easily with java.io.LineNumberReader and then parsed with a java.util.StringTokenizer into the three input values.

    Then, it's just a matter of computing a value for "d", after which the required "if" (or "switch") comes in to play. Looks like you might need another "if" to test for a==0.

    Open Source is free like a puppy is free.

    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.

    Understanding Evolution

  3. #3
    Goldfish
    Join Date
    Dec 2002
    Location
    Washington, D.C.
    Posts
    81
    I'm having trouble getting started with setting up variables, if statements, etc.. I'm trying to write an algorithm before I program it because she wants to see a typed algorithm before we start to code the program.

    I think the way you explained it gave me a good idea. Thanks a lot for the help so far.

  4. #4
    Hammerhead Shark EverlastingGod's Avatar
    Join Date
    Feb 2003
    Location
    MD
    Posts
    1,364
    Originally posted by Cod
    I'm trying to write an algorithm before I program it because she wants to see a typed algorithm before we start to code the program.
    Start out general and refine each step... First, you should just be writing how you'd solve it w/o a computer.

    For example, start with:

    repeat until done
    - read input
    - compute
    - write output

    Then break each of those steps down.
    Stay cool
    and be somebody's fool this year

Posting Permissions

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