Menu

[solved]-Code Java Textfile01txt Mary Little Lamb S Fleece White Snow Everywhere Mary Wentthe Lamb Q39080403

Code in Java

Requirements Write a Java program to: Open the two input files (using Scanner objects is recommended) Process until all lines

Expected Output Comparison of Input Files Non-matching Lines Only Input 01: Its fleece was white as snow; Input 02: Its flee

textFile01.txt

Mary had a little lamb,It’s fleece was white as snow;And everywhere that Mary wentThe lamb was sure to go.He followed her to school one dayWhich was against the rule;It made the children laugh and play,To see a lamb at school.And so the teacher turned him out,But still he lingered near;And waited patiently aboutTill Mary did appear”What makes the lamb love Mary so?”The eager chldren cry;”Why, Mary loves the lamb, you know,”The teacher did reply.

******************************

textFile02.txt

Mary had a little lamb,Its fleece was white as snow;And everywhere that Mary wentThe lamb was sure to go.He followed her to school one day,Which was against the rule;It made the children laugh and play,To see a lamb at school.And though the teacher turned him out,But still he lingered near;And waited patiently aboutTill Mary did appear.”What makes the lamb love Mary so?”The eager chldren cry;”Why, Mary loves the lamb, you know,”Teacher did reply.Requirements Write a Java program to: Open the two input files (using Scanner objects is recommended) Process until all lines are read (files have the same number of lines); Read input from both files as String data Compare the two String objects If the String objects are not the same, output a report line (format provided) o You may not use an array or arrays in processing!! Close the input files O O Expected output has been provided; the report heading is not necessary; however, it is advisable. Helpful Hints 1. The two files contain the same number of lines 2. If you use the following format String, the output will align as shown in the Expected Output “Input 01: %-40s t In put 02: %-40s%n” Expected Output Comparison of Input Files Non-matching Lines Only Input 01: It’s fleece was white as snow; Input 02: Its fleece was white as snow; Input 01: The lamb was sure to go Input 02 The lamb was sure to go. Input 01: He followed her to school one day Input 02: He followed her to school one day, Input 01 And so the teacher turned him out, Input 02: And though the teacher turned him out, Input 01 Till Mary did appear Input 02: Till Mary did appear. Input 01 The teacher did reply Input 02: Teacher did reply. Show transcribed image text Requirements Write a Java program to: Open the two input files (using Scanner objects is recommended) Process until all lines are read (files have the same number of lines); Read input from both files as String data Compare the two String objects If the String objects are not the same, output a report line (format provided) o You may not use an array or arrays in processing!! Close the input files O O Expected output has been provided; the report heading is not necessary; however, it is advisable. Helpful Hints 1. The two files contain the same number of lines 2. If you use the following format String, the output will align as shown in the Expected Output “Input 01: %-40s t In put 02: %-40s%n”
Expected Output Comparison of Input Files Non-matching Lines Only Input 01: It’s fleece was white as snow; Input 02: Its fleece was white as snow; Input 01: The lamb was sure to go Input 02 The lamb was sure to go. Input 01: He followed her to school one day Input 02: He followed her to school one day, Input 01 And so the teacher turned him out, Input 02: And though the teacher turned him out, Input 01 Till Mary did appear Input 02: Till Mary did appear. Input 01 The teacher did reply Input 02: Teacher did reply.

Expert Answer


Answer to Code in Java textFile01.txt Mary had a little lamb, It’s fleece was white as snow; And everywhere that Mary went The lam… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *