write my assignment 26252

Below are the instructions for assignment and additional instructor notes for the code.

***Assignment Instructions****

Use the “starter” code to make changes to the Java™ program that prompts the user for input, accepts user input, and produces both console and file output.

Add comments where code was added.

***Instructor Notes**

This assignment is a little vague. I would ask the user for the name of file to write to from the console using the Scanner class. Write to this file and to the console, the string of the count, 0 to 9 in a for loop.

***Code Files****

StarterDemo (based on instructor feedback, I don’t believe any other work needs to be done w/ StarterDemo Class)

 */

/**

 * Starter class and call the needed method.

 * @author

 */

public class StarterDemo {

   public static void main(String[] args) {

       Starter starter = new Starter();

       starter.getInput();

   }

}

————————

Starter File

import java.io.*;

import java.util.Scanner;

/**

 * The Starter class accepts user input and outputs it to a file and the

 * console.

 *

 * @author

 */

public class Starter {

   private Scanner input;

   private double data;

   private String fileName;

   private String line;

   private FileReader fileReader;

   private PrintStream fileStdout;

   /**

    * Prompts and accepts user input and output to console, numbers 0 through

    * 9,

    *

    */

   public void getInput() {

       System.out.println(“Enter the name of the .txt file to write to and from.”);

       input = new Scanner(System.in);

       fileName = “input.txt”;

       line = null;

       try {

           fileReader = new FileReader(fileName);

           try {

               // coding block to output data to file

               fileStdout = new PrintStream(new FileOutputStream(“data.txt”));

               System.out.println(“==============”);

               int i = 0;

               fileStdout.println(“” + i);

           } catch (Exception e) {

           }

       } catch (Exception ex) {

       }

   }

}

 
"Not answered?"
Get the Answer