Answered You can hire a professional tutor to get the answer.

QUESTION

Below are the instructions for assignment and additional instructor notes for the code. ***Assignment Instructions**** Build on starter

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

***Assignment Instructions****

Build on "starter" code to create a Java™ program that prompts the user for input, accepts user input, and produces both console and file output.

Copy the linked code to a JAVA file.

Add Java® code based on the comments inside the code.

Test, debug, and run your code using the NetBeans editor to make sure it meets the program requirements.

***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)

 */

/**

 * Create a Starter class and call the needed method.

 * @author Janet

 */

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) {

       }

   }

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question