Trying to make a working Program. Don't know how to build it. It should be easy

Discussion in 'Software' started by keith23, Oct 18, 2007.

  1. keith23

    keith23 Private E-2

    Tomorrow I have an exam that requires that I know how to read inputs from a text file and display results. I was given an assignment, that If I can solve it, will help me with tomorrows exam. I don't expect anyone to help me write this. But whoever does, Thanks a lot. It's not suppose to take long at all to write. I just can't get it figured out. The assignment is as follows:
    Problem 1 part a: Create the following text file ("Week9.txt"), which states exactly as written:
    78 George
    90 John
    97 Alex
    80 Thomas
    75 James
    87 Andrew
    55 Frank
    82 Anna
    91 Maria
    74 Anton
    92 Carolina

    Problem 1 part b: Write a program that reads data from the file "Week9.txt" and displays:
    The Person's name, his/her score and comment: "good job", if the score is at least 80, "work harder", if 60<=score<80, "see your teacher", if score<60.
    The Person's name with highest score
    The Person's name with lowest score
    The average score


    Additional Details

    the programming language I'm using is Java, and I use JGrasp to run it.

    Also this is the code I came up with


    import java.io.*;
    import java.util.*;

    class ReadName
    {
    public static void main (String args []) throws IOException
    {
    String name;
    int score;
    Scanner inFile=new Scanner (new File ("Week9"));
    while (inFile.hasNext();
    }
    inFile.close();
    System.out.println();
    }
    public static findGrade (int n)
    {
    String a;
    if (n>=80)
    a="good job"
    else if (n<80&&n>=60)
    a="work harder";
    else
    a="see your teacher";
    return a;
    }
    }
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds