Question
Write a program that reverses a text file by using a stack. The user interface must consist of 2 list boxes and 3 buttons. The
Write a program that reverses a text file by using a stack. The user interface must consist of 2 list boxes and 3 buttons.
The 3 buttons are:
Read - reads the text file into list box 1.
Reverse - reverses the items in list box 1 by pushing them onto stack 1, then popping them from stack 1 (in the reverse order) and adding them to list box 2.
Write - writes the contents of list box 2 to a new text file.
At first, only the Read button is enabled. After it is clicked, it is disabled and the Reverse button is enabled. After it is clicked, it is disabled and the Write button is enabled. After it is clicked, it is disabled.
The name of the input text file is "input.txt". The input text file will contain no more than 100 lines of text. This fact is not needed by the program. It simply means that memory usage is not an issue.
The name of the output text file is "output.txt".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started