Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

APR 1 Question 2: 2. (10 pts) Assume that you want to use both an input file called myWords.txt and an output file called

image

APR 1 Question 2: 2. (10 pts) Assume that you want to use both an input file called "myWords.txt" and an output file called "myOutput.txt" which are located in a folder called "myFiles" that is within the project directory. In the program below, fill in all the missing details so that you can read a series of words (one by one) from this external file into the variable 'newWord". Continue to read words and process them until you have processed the word "DONE". All words read in should be printed to the output file, each on a separate line followed by a space followed by the first letter of the word followed by a space followed by the last letter of the word. Note: there may be more than a single word on each line of the input file. For example: Computer Cr Exam E m DONE DE At the end, print, to the console, the total number of words read in from the input file. To do this you may have to declare additional variables, include statements to control reading from and writing to files, etc.. }. import java.util.Scanner; import java.io.*: public class problem2 ( public static void main(String[] args) throws IOException ( String newWord; do {. //read a word into newWord - you must show how } while //needed to use Scanner Class //needed for File 10 S C e tv A

Step by Step Solution

There are 3 Steps involved in it

Step: 1

java import javautilScanner import javaio public class problem2 public static void mainString args throws IOException Create a File object for the input file File inputFile new FilemyFilesmywordstxt C... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Chemistry The Central Science

Authors: Theodore Brown, Eugene LeMay, Bruce Bursten, Catherine Murphy, Patrick Woodward

12th edition

321696727, 978-0132175081, 978-0321696724

More Books

Students also viewed these Programming questions

Question

Explain the relationship between thoughts, feelings, and actions.

Answered: 1 week ago