Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By PhQ

Thread: Need help starting a program.

  1. #1
    cagipple is offline Member
    Join Date
    Mar 2011
    Posts
    11
    Rep Power
    0

    Default Need help starting a program.

    I have to write a program that reads in a file of male and female GPAs, then gives me the avergae male gpa and average female gpa.

    The text in the file will look like this:

    f3.9
    m4.0
    f2.5
    m3.4

    Where the first character represents male or female and the number represents the gpa obviously. Can anyone point me in the right direction on how to start this?

  2. #2
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    5

    Default Re: Need help starting a program.

    You can read each line of the file and get the String's first index using string.charAt(int index).

    If you are unsure how to read files here is an example: Java Read File Line By Line,How to Read File Line By Line in Java
    Last edited by PhQ; 09-19-2011 at 08:36 PM.
    Fubarable likes this.

  3. #3
    cagipple is offline Member
    Join Date
    Mar 2011
    Posts
    11
    Rep Power
    0

    Default Re: Need help starting a program.

    Thanks, I'll give that a go.

Similar Threads

  1. Just starting with Applets
    By Josep_16 in forum Java Applets
    Replies: 3
    Last Post: 07-13-2011, 05:03 PM
  2. Starting Out...
    By maknib in forum Java Gaming
    Replies: 1
    Last Post: 11-11-2010, 09:15 PM
  3. Help with starting program please
    By SF163 in forum New To Java
    Replies: 5
    Last Post: 11-07-2009, 04:33 PM
  4. Need help starting program
    By mk3823 in forum New To Java
    Replies: 8
    Last Post: 11-02-2008, 02:41 AM
  5. just starting
    By specbailey in forum New To Java
    Replies: 23
    Last Post: 08-14-2007, 12:25 AM

Posting Permissions

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