This site requires JavaScript, please enable it in your browser!
Greenfoot back
bizzard
bizzard wrote ...

2014/4/16

Help with my Project no idea how to do it?

bizzard bizzard

2014/4/16

#
prompts the user to enter filename(as string) corresponding to an input file.this file will be formatted such that on each line there is a name with no whitespace follwed by some whitespace, followed by an exam score. my program should then print out two lines the console. the first line will be the name and sore of the person the highest on the exam. the second will be the name and score of the person who name is alphabetically first. example lary 75 moe 82 curly 66 lisa 98 bart 71 output higest score : lisa (98) lowest alhabetically : bart (71)
Entity1037 Entity1037

2014/4/16

#
Try using a PrintWriter. Here's an example:
try{
    String name = "Bob";
    File file = new File("C:/User/Desktop/Hello World");
    PrintWriter writer = new PrintWriter(file);
    writer.println("Hello World!");
    writer.println("My name is "+name+"!");
    writer.close();
}catch(FileNotFoundException e){}
bizzard bizzard

2014/4/16

#
thank you
You need to login to post a reply.