APR 1 Question 2: 2. (10 pts) Assume that you want to use both an input...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
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... View the full answer
Related Book For
Chemistry The Central Science
ISBN: 978-0321696724
12th edition
Authors: Theodore Brown, Eugene LeMay, Bruce Bursten, Catherine Murphy, Patrick Woodward
Posted Date:
Students also viewed these programming questions
-
Let r and s be solutions to the quadratic equation x 2 b x + c = 0. For n N, define d0 = 0 d1 = r s dn = b dn1 c dn2 (n 2) Prove that dn = r n s n for all n N. [4 marks] (b) Recall that a commutative...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
Match the following ratios with the appropriate formula. Ratio or Rate Formula a. Income from operations Interest expense Acid-test Total liabilities Stockholders' equity Current b. Net income-...
-
Vincent Fairfield, CEO of MetroAir, sat at his desk, examining the company's latest financial statements. "This just doesn't make sense to me," Vincent thought. "We're reporting $1,662,015 in net...
-
What is an intranet? Give specific examples of benefits for firms that have their own intranets.
-
What is an investors objective in financial statement analysis? (a) To decide whether the borrower has the ability to repay interest and principal on borrowed funds. (b) To determine if the firm...
-
The following information is available for Renteria Manufacturing Company for the month ending March 31, 2008: Cost of goods manufactured ... $265,000 Selling expenses ......... 85,000 Administrative...
-
Write a detailed description of the selected practice role. Include key aspects such as the role's functions, importance in a professional context, and any specific skills or knowledge required.
-
Which of the following statements about the basic structuralfeatures of DNA are true? The major and minor grooves form in the DNA helix because theDNA strands are antiparallel. The major and minor...
-
Coming up with a few ideas for this question: A heavy-duty trucks parts re-manufacturing company has hired you as a consultant to review its current accounting procedures and to provide it with a...
-
Finance professionals can best serve their organizations by attentiveness to what three financial realities?
-
What are the 2 breaches that are punishable by 2000 penalty units in this Section?
-
What is the PERT weighted average based on an optimistic estimate of eighteen days, a most likely estimate of twenty-two days, and a pessimistic time of thirty days?
-
1. Blue Bird Corporation is considering the following mutually exclusive projects. Expected cash Flows 701234 Year Project A Project B Tk (3,500) Tk (3,500) 2,700 500 1,000 1,000 1,200 2,200 400 500...
-
Describe how the proposal below will decrease the risk of the company (Chipotle). Proposal This proposal provides a convenient and easy meal-time solution. This option offers customers the ability to...
-
The graph of the sequence whose general term is an = n - 1 is which of the following? [8.1] A. B. TITTT 3-2-1 23.45 2.3.4
-
(a) What is the molality of a solution formed by dissolving 1.12 mol of KCl in 16.0 mol of water? (b) How many grams of sulfur (S8) must be dissolved in 100.0 g naphthalene (C10H8) to make a 0.12 m...
-
Write the balanced chemical equations for (a) The complete combustion of acetic acid (CH3COOH), the main active ingredient in vinegar (b) The decomposition of solid calcium hydroxide into solid...
-
Acetylsalicylic acid, better known as aspirin, has the Lewis structure (a) What are the approximate values of the bond angles labeled 1, 2, and 3? (b) What hybrid orbitals are used about the central...
-
Explain what happens when a B cell first encounters a pathogen and binds to an antigen on the pathogen.
-
Why is a single innate immune cell able to respond to many different pathogens?
-
What is an antigen?
Study smarter with the SolutionInn App