Answered step by step
Verified Expert Solution
Link Copied!

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

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... 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

Java Concepts Late Objects

Authors: Cay S. Horstmann

3rd Edition

1119186714, 978-1119186717

More Books

Students also viewed these Programming questions