Question: A. Create a program that reads Mary Had A Little Lamb. Save the following EXACT text to a location on your system as a
A. Create a program that reads "Mary Had A Little Lamb." Save the following EXACT text to a location on your system as a plain text file named Mary. txt: Mary had a little lamb Its fleece was white as snow And everywhere that Mary went The lamb was sure to go Ideally, the file should be saved in the same folder as your program. Your tasks: The first line of Mary.txt just happens to be the title of this nursery rhyme, too. Use a for loop to output this line to the screen as a title line, capitalizing the first letter of each word of this line so it reads: Mary Had A Little Lamb Follow this line of output with a blank line. (Hint: You will need the toUpperCase and substring Java methods to properly format the title line. See Chapter 9 of your book or w3schools Java String Methods Reference.) After the title line, use a while loop to output each line of the verse from Mary.txt so your full output looks like this: Mary Had A Little Lamb Mary had a little lamb Its fleece was white as snow And everywhere that Mary went The lamb was sure to go
Step by Step Solution
There are 3 Steps involved in it
Java program to read and display the lines from the input file Marytxt import javaioFile import java... View full answer
Get step-by-step solutions from verified subject matter experts
