Why doesn’t the following pseudocode module work as indicated in the comments? // The readFile method accepts a string containing a filename as // an argument. It reads and displays all the items in the file. Module readFile(String filename) // Declare an input file. Declare InputFile file // A variable to hold an item that is read from the file. Declare String item // Open the file using the filename. Open file filename // Read all the items in the file and display them. While eof(file) Read file item Display item End While End Module

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question

Why doesn’t the following pseudocode module work as indicated in the comments?

// The readFile method accepts a string containing a filename as

// an argument. It reads and displays all the items in the file.

 

Module readFile(String filename)

   // Declare an input file.

   Declare InputFile file

 

   // A variable to hold an item that is read from the file.

   Declare String item

 

   // Open the file using the filename.

   Open file filename

 

   // Read all the items in the file and display them.

   While eof(file)

       Read file item

       Display item

   End While

End Module

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT