IDE Practical

The setup

Start by creating a project that contains the following class. You should be able to determine the appropriate class and package names from the first few lines of the file.

package edu.unca.cs.csci202;

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

public class PracticalFall2013 {

    public static void main(String[] args) {

        // CHANGE 1
        // Create a Scanner object from System.in
        // Store the Scanner in a variable stdIn
        // ... stdIn = ... ;
        
	// CHANGE 2
        // Read and trim a line of input using stdIn
        // Store the trimmed line in a variable outFilename
        // ... outFilename = .... ;

	// CHANGE 3
        // Using outFilename as a filename, create a PrintWriter
        // Store the PrintWriter in a variable outWriter.
        // If an exception occurs, simply return from this method.
        // ... outWriter = .... ;

	// CHANGE 4
        // Write a line saying "I'm done" to outWriter

        // CHANGE 5
        // Do that one final thing that must be done when writing a file.
    }
}

The task

Within the Java class there are comments, repeated below, giving four small changes to be made to the program.

  1. Create an Scanner object called standardIn from the System.in InputStream.
  2. Read and trim a line of input using stdIn. Store the trimmed line in outFilename.
  3. Create a PrintWriter called outWriter using the filename stored in outFilename.
  4. If the open succeeded, write a line containing "I'm done" to outWriter.
  5. Do that one last thing that needs to be done.

The upload

When you are done, upload your Java program to the IDE Practical dropoff on moodle.