Write a program that collects an input filename and an output filename. The inpu
ID: 3656441 • Letter: W
Question
Write a program that collects an input filename and an output filename. The input file contains lines with two double numbers per line. Write the maximum of each line in the input file to the output file (one average per line). Use a Scanner to collect the filenames from the user. Test your program using numbers . txt for input. C:UsersaronDesktop>java question2 Enter input file name: numbers.txt Enter output file name: max.txt processing complete. After completion, my program produces max. txt with contents: 15.42 0.25 -8.1 15.9 1024.0 0.001 15. 92 18.26 55.931 512.0 Modify your program so that it prints the maximum of each line even if there are not exactly two numbers on each line of the input file. Assume there is at least one number per line. Test using moreNumbers . txt.Explanation / Answer
import javax.swing.*; import java.io.*; public class file { public static void main(String []args)throws IOException { FileWriter ryt=new FileWriter("c:\alpe.txt"); BufferedWriter out=new BufferedWriter(ryt); String name=JOptionPane.showInputDialog("Enter your name pls."); out.write("Hello, "+name+"!"); out.write(" This the simple txt file that you created!"); out.close(); } } 2.public class DocumentS { public static void main(String[] args) { In in0 = new In(args[0]); int wordCount = 0; int charCount = 0; while (!StdIn.isEmpty()) { wordCount++; String str = in0.readAll(); for (int i = 1; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.