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
Trending nowThis is a popular solution!
Learn your wayIncludes step-by-step video
Chapter 10 Solutions
Starting Out with Programming Logic and Design (4th Edition)
Additional Engineering Textbook Solutions
Software Engineering (10th Edition)
C++ How to Program (10th Edition)
Starting Out with C++: Early Objects (9th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Database Concepts (8th Edition)
Starting Out with Python (4th Edition)
- Word List File Writer: Write a program that asks the user how many words they would like to write to a file, andthen asks the user to enter that many words, one at a time. The words should be writtento a file (in python)arrow_forwardC lanaguge Managing Student Information! C LANGUAGE We're going to build a student information management system. The user should be shown a menu with four options: display student initials, display student GPAs, add students, or exit the program. If the user chooses to exit, the program should end. Otherwise, if the user chooses to display the student initials, the contents of the students.txt file should be read, and just the student number and initials should be displayed to the user in a tabular format. If the user chooses to display the student GPAs, the contents of the students.txt file should be read, and just the student number and GPAs should be displayed to the user in a tabular format. If the user chooses to add students, they should be prompted for the number of studnets they’d like to add. They should then be prompted that many times for a studnet number, a GPA, a first initial, and a last initial. Each of the new items should be saved to the students.txt file.…arrow_forwardC programming language Criteria graded: Declare file pointers Open file Read from file Write to file Close file Instructions: Write a segment of code that opens a file called “numbers.txt” for reading. This file is known to have 10 numbers in it. Read in each number and print a ‘*’ to the screen if the number is even. If the number is odd, do nothing. Conclude by closing this file.arrow_forward
- Problem: Write a Python program that reads from an input file named employees.txt some employee information and produces a salaries report on screen. The input file employees.txt has a number of data lines. Each data line in the input file contains information about one employee including: first name, last name, job code (an integer between 1 and 4), and the number of days worked. The following is an example of what the input file employees.txt can contain: Ali Al-Harthi 22 Laila Al-Busaidi 4 25 Salim Al-Hajri Badria Al-Sinani 2 21s 19 Abir Al-Hinai 1 15 Your program should produce a salaries report on screen using the format shown below. Enter input file name: employee.txt Name Job Code Days Worked Salary (OMR) Ali Al-Harthi 3 22 660.000 Laila Al-Busaidi 4 25 637.500 Abir Al-Hinai 15 600.000 Number of faulty records = 2 Number of valid records = 3 Average salary = 632.500 The salary of each employee is equal to the number of days worked multiplied by the daily pay rate. The daily pay…arrow_forwardAlgorithm Workbench 1. Write a program that opens an output file with the filename my_name.txt, Writes your name to the file, then closes the file. 2. Write a program that opens the my name.txt file that was created by the program in problem 1, reads your name from the file, displays the name on the screen, then closes the file.arrow_forwardLine Numbers Write a program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1. Pythonarrow_forward
- 1. Random numbers File: random_numbers.py (Quick note: NEVER name your files the same as a Python module. If you call this file random.py it won't let you import the real random.) (Another quick note: Don't let yourself get stuck on something for too long. If one part of one question starts taking you too long, just leave it, move on and come back to it later.) Write a complete Python program that ask the user for quantity of random numbers and a maximum, then generates and store that many numbers between 0 and the maximum. When you've got this part working, add the following interesting additions: minimum maximum random choice from existing list (Hint: if there are 7 numbers it will be a number at a random index 0-6) the list reversed* the list sorted* Note*: Python's .reverse() and .sort() list methods do NOT return the reversed or sorted list... they modify the list in place.So, if you write something like: print(numbers.sort()) You will not get what you expect. You'll sort the…arrow_forward#function read file and display reportdef displayAverage(fileName):#open the fileinfile = open(fileName, "r")#variable declaration and initializationtotal = 0count = 0#read filefor num in infile:total = total + float(num)count = count + 1#close the fileinfile.close()#calculate averageaverage = total / count#display the resultprint("Average {:.1f}".format(average)) #method callingdisplayAverage("numbers.txt")arrow_forwardTo set up a file to perform file I/O, you must declare Group of answer choices at least one variable to write to the file. one or more file stream objects. a string array to store the file contents. All of these None of thesearrow_forward
- Need this done in C# Microsoft Visual Studio. Also please include the names of labels, textbox, button etc.. Comments and screenshots of the process are appreciated too! Thank you in the images is the question as well as the example.arrow_forwardDebug thisarrow_forwardgetline(myfile,str); * 2 points writes a line of text str from the file myfile reads a line of text to str from the file myfile writes a character str to the file myfile reads a character str from the file myfilearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education