Question: In Java, given code below question: package edu.wit.cs.comp1000; import java.io.PrintWriter; import java.util.Scanner; //TODO: document this class public class PA8a { /** * Error to output
In Java, given code below question:

package edu.wit.cs.comp1000;
import java.io.PrintWriter;
import java.util.Scanner;
//TODO: document this class
public class PA8a {
/**
* Error to output when a file cannot be opened.
*/
static final String E_NOT_FOUND = "Error! File not found!";
/**
* Reads all integers in input scanner,
* outputs positive ones to output each on
* its own line
*
* @param input input source
* @param output output destination
*/
public static void process(Scanner input, PrintWriter output) {
// TODO: write your code here
}
/**
* Program execution point:
* input an input file name and an output file name,
* for each positive number in the input file
* print on its own line to the output file
*
* @param args command-line arguments (ignored)
*/
public static void main(String[] args) {
// TODO: write your code here
}
}
Problem a (PA8a.java) Write a program that reads a stream of integers from a file and writes only the positive numbers to a second file. The user should be prompted to enter the names of both the input file and output file in main), and then main() should attempt to open both files (providing an error if there is an error during this process). The main method should then call the process method to read all the integers from the input file and write only the positive integers to the output file. The process() method takes as arguments a Scanner to read from the input and a Printwriter to write to the output. You can assume that if you are able to successfully open the input file, then there will only be integers in it. You have been supplied JUnit tests for the process() method, as well as the output for several example file contents
Step by Step Solution
There are 3 Steps involved in it
To solve this problem youll need to complete the process method and implement the main method to handle file input and output Heres how you can struct... View full answer
Get step-by-step solutions from verified subject matter experts
