Question
(JAVA) Complete the following program to read integer values from a file called input.txt and write the sum of each pair into a file called
(JAVA)
Complete the following program to read integer values from a file called input.txt and write the sum of each pair into a file called output.txt. For example, given input.txt as: 10 20 30 40
output.txt would contain: 30 70
Note: You may assume that there is always an even number of integers in the input file and you do not have to do any exception handling.
import java.io.PrintWriter; import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException; public class Quiz9 { public static void main (String [] args) throws FileNotFoundException {
// YOUR CODE HERE
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started