Turn in a printout of your program Homework6.java. Your .java and .class files should be in your cosc1123 directory.
1. Write a program that prompts the user to enter the name of an input file, and then writes every other line (starting with the first line) from the input file to the file everyOther.txt. Print the length of each line to the screen. Suppose the text file data.txt contains:
Hello, hi
The quick brown
fox jumps over
the pond
Sample Run:
Please enter the input file: data.txt
The length of the lines: 9 15 14 8
When you open the file everyOther.txt, it contains:
Hello, hi
fox jumps over
2. Write a program that stores integer exam scores in an array. Ask the user to enter the number of exam scores, and then prompt the user to enter each exam score. Then offer the user a choice of the options: average, min, max, and produce the requested value for the given exam scores.
Sample Run:
How many exam scores? 4
Exam 1: 90
Exam 2: 100
Exam 3: 80
Exam 4: 90
Calculate 1) average, 2) min, 3) max: 2
Min: 80