Question: For this assignment, you will build on starter code to create a Java program that prompts the user for input, accepts user input, and produces
For this assignment, you will 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.
**Starter Code**
package demo; import java.util.Scanner; // scanner is a predefined class for taking inputs from user public class Startercode { public static void main(String[] args) {
// prompts and accepts user input Scanner input= new Scanner(System.in); double data; System.out.println("Enter value ");
// accepts file input String fileName = "input.txt"; // name of the file to open String line = null; // will reference one line at a time
try { FileReader fileReader = // FileReader reads text file new FileReader(fileName); // reads in data from the file // produces both console and file output try { // coding block to output data to file fileStdout = new PrintStream(new FileOutputStream("data.txt")); // output file name is data.txt System.out.println("=============="); // output to console, numbers 0 through 9 fileStdout.println("" + i);
// ENTER YOUR CODE HERE. Enter code to end program successfully.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
