Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Java program to read and display the lines from the input file Marytxt import javaioFile import java...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started