View the step-by-step solution to:

Question

Here is the assignment and my code. I've posted this before and no one could answer...... Really not sure what

some of these commands are... I'm using eclipse and have to turn it in through zybooks, which is very picky about formatting and specific commands. How do I call these commands? I'm new to everything so seeing it filled in with comments helps me to understand I'm very lost.

Screen Shot 2019-09-23 at 8.03.16 AM.png

Screen Shot 2019-09-23 at 8.03.16 AM.png

(0) Write a method getIdentificationString ( ) that returns a string containing the programming assignment and
your name. DO NOT call this method. Just make sure it is there and working correctly. The automatic grader will verify it.
EX.
Program 5a, Patty Kraft
(1) Your task is to fix all the "TODO's in the following code.
/ / TODO import statements
public class WriteCSV {
public static void main (String args) {
// Grading program needs hardcoded filename. Oh, well. "
String inputFilename = "coords. txt";
String outputFilename = changeFileExtToCsv (inputFilename) ;
/ / Open files
Scanner input = / /TODO: call method to open input file
PrintWriter output = / /TODO:
call method to open output file
// TODO: Read input line, replace all spaces with commas,
and write output line
while (input . hasNextLine () ) {
/ / TODO: close streams
1 * *
* Changes file extension to ". csy"
*
@param filename
* @return
public static String changeFileExtToCsv (String filename) {
return filename . substring (0, filename . lastIndexOf ( ' . ') ) + ".cav";
}
1* *
* Open input for reading
* @param filename
* @return
public static Scanner openInput (String filename) {
Scanner in = null;
try
File infile = new File (filename) ;
in = new Scanner (infile) ;
} catch (FileNotFoundException e) {
//e. printStackTrace () ;
System. out . printIn (filename + " could not be found") ;
System. exit (0) ;
return in;
1 * *
* Open output for writing
* @param filename
* @return
public static PrintWriter openOutput (String filename)
//TODO: Write method to open a PrintWriter ; use openInput () as a guide

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes