Question: Write a program that reads in the text file names.txt provided in the assignment folder in blackboard. You are allowed to use a fixed size
Write a program that reads in the text file "names.txt" provided in the assignment folder
in blackboard. 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 Sort is easiest to code. 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 functions.
In Visual Basic, if you simply specify the filename in the
IO.File.OpenText() 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:\Trent_Teaching\1520h_VB\VB_Projects\Assignment_4\File_Sort_Assig
nment4\File_Sort_Assignment4\bin\Debug
Should you have difficulty placing the data file there, you are allowed to
specify a complete path to the filename in the function call. As an example if
I am developing my application in the folder
D:\Trent_Teaching\1520h_VB\VB_Projects\Assignment_4, I could place
the names.txt file in that directory. I would then change the function call to be:
IO.File.OpenText("D:\Trent_Teaching\1520h_VB\VB_Projects\Assignment_4 ames.txt")

names.txt includes these names
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
File Sort File Content Edwin Hubble Robert Oppenheimer Jonas Salk Richard Feymman James Watson Carl Sagan Annie Jump Cannon Henrietta Leavitt Dian Fossey Barbara Mcantock 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 Read in names bd Ascending Order Descending Order Sorted Output Exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
