Reading files and writing files
I as of right now have no code. I'm just stuck on the problem and don't know how to start. I'm a beginner programmer so don't expect too much from me.
The assignment can be found here: http://www.cas.mcmaster.ca/~khedri/w...ssignment4.pdf
If someone can just guide me that would be greatly appreciated. It's not a difficult task for some of you, but it is for me.
Re: Reading files and writing files
You will want to post all relevant material here in the forum rather than as a link. This might mean that you have to put in the effort to type in a bit of text, but it is well worth it if we are to better understand your problem. Next you will want to tell us exactly where you're stuck and what confuses you. Very vague questions, such as "I don't know where to start" often lead to recommendations to read or re-read the tutorials. So if you can give as as good a description of your specific problems, we can likely give you better and more helpful answers.
Re: Reading files and writing files
At the bottom of the assignment, it tells me to use these method signatures. Not sure what they do, but I just copied and pasted it into my new class file. I started by writing the code for opening the file and the try/catch exception handling. But other then that I'm completely confused on how to read the file for the 3rd field.
--- Update ---
Code :
public class RecordReader {
public static String[] readThirdFieldsFromFile(String inputFileName) throws FileNotFoundException, IOException{
Scanner newScanner = newScanner(System.in);
try{
System.out.print("Enter the name of a file you wish to open: ");
String fileName = newScanner.nextLine();
newScanner = newScanner(new File(fileName));
}
catch (exception FileNotFoundException){
System.out.println ("FileNotFoundException");
}
}
}
So far the only thing I have :|
Re: Reading files and writing files
Again, consider typing in your assignment instructions here. Many (myself included) will avoid clicking on links, or are unable to due to firewall restrictions.
Re: Reading files and writing files
1 Attachment(s)
Re: Reading files and writing files
Okay the file didn't show up as good as i thought it would. Give me another minute