Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

VISUAL BASIC: Write a program that reads in the text file names.txt provided in the assignment folder in blackboard. You MUST use the OpenTextFileReader approach

VISUAL BASIC: Write a program that reads in the text file "names.txt" provided in the assignment folder in blackboard. You MUST use the OpenTextFileReader approach and read each line individually in a loop checking for the end-of-file condition. You are allowed to use a fixed size array for this project. Assume a maximum file size of 100 entries. Make sure you count how many you retrieve from the file! Your program should then display all of the names, in the provided order, in a list box on the left hand side of the form. You should then create two buttons on your form. One button will sort the list into ascending order, the other descending order. You may use any sort algorithm that you want though I would suggest the Bubble Sortis easiest to code. You must write your own version of the sort algorithm. The result of the sort should then be displayed in a separate list box on the right hand side of the form. Something similar to the following: NOTE: You must write your own SORT routine. You are not allowed to use the internal Visual Basic Sort.

In Visual Basic, if you simply specify the filename in the OpenTextFileReader() function call, then VB will expect the file to reside in the bin\Debug subdirectory where you are storing your source code. In my case the file is actually stored in: D:\ Assignment_4\bin\Debug For the sake of this assignment, place the data file at the top level of your project directory. As an example if I am developing my application in the folder D:\Assignment_4, I would place the names.txt file in that directory. I would then change the function call to be: My.Computer.FileSystem.OpenTextFileReader ("D:\ Assignment_4 ames.txt") NOTE: Ensure that you submit a well written and well documented program. Also make sure that your variable and control names are representative of their use/function.

txt file content:

Edwin Hubble Robert Oppenheimer Jonas Salk Richard Feynman James Watson Carl Sagan Annie Jump Cannon Henrietta Leavitt Dian Fossey Barbara McClintock Grace Hopper Maria Mitchell Al-Zahrawi Al-Zarqali Ibn al-Shatir Al-Khalili al-Jazari Al-Idrisi Ruby Payne-Scott Gregor Mendel Erwin Schrodinger Lise Meitner Isaac Newton Michael Faraday Charles Babbage Charles Darwin William Thomson Kelvin Alan Turing Stephen Hawking Jane Goodall Frederick Banting Sylvia Edlund Roberta Bondar Kathleen I. Pritchard Margaret Chan Zhang Heng Zu Chongzhi Qin Jiushao Nikola Tesla Niels Bohr Robert Boyle Edmond Halley Blaise Pascal Louis Pasteur Irene Joliot-Curie Johannes Kepler Albert Einstein Maria Goeppert-Mayer Caroline Herschel Carl Friedrich Gauss Hippocrates Aristotle Archimedes Edward Teller Srinivasa Ramanujan C. V. Raman Satyendra Nath Bose Subrahmanyan Chandrasekhar Brahmagupta Ada Yonath Leonardo da Vinci Nicolaus Copernicus Galileo Galilei Ernest Rutherford Marie Curie Maria Sklodowska-Curie Dmitri Mendeleev Vera Faddeeva James Watt Alexander Fleming Anders Celsius Alfred Nobel

How file should look:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions