Ruby Exercise Ruby Addresses File Input Output Use Text Files Folders Topics Taken Textboo Q43802150
FOR RUBY:
This is an exercise in Ruby that addresses:
- File Input and Output
- Use Text Files and Folders
Topics are taken from the textbook Ruby Programming by Jerry LeeFord, Jr. Chapter 9.
—————————————————
The assignment:
Summary: You are creating a small program that allows the user to create a text document named ‘Resolutions, and store that text file in a folder of their choosing. Once the file has been created and stored, allow the user to type in the path for the file, so they can view the contents. • The solution should be named FileTest.ro . Include these steps: o Ask the user to input a path and folder name (ex. C: Williams). Check to see if the folder exists. If so, output a message to the user stating “Folder found”. If the folder does not exist, create the folder, and output a message to the user stating “Folder created.” o Create a file in the user’s folder named resolutions.txt. Be sure the file is writable. Have the user type in their resolutions… when they type ‘q’, the list is done. o Ask the user to type in the path where the resolutions. txt resides. If the file is found, tell the user to hit the enter key to view the contents. If the file cannot be found, notify the user and ask if they would like to try again. o Give them three tries to type in the correct path. • Run your program until it works and the output looks nice. Show transcribed image text Summary: You are creating a small program that allows the user to create a text document named ‘Resolutions, and store that text file in a folder of their choosing. Once the file has been created and stored, allow the user to type in the path for the file, so they can view the contents. • The solution should be named FileTest.ro . Include these steps: o Ask the user to input a path and folder name (ex. C: Williams). Check to see if the folder exists. If so, output a message to the user stating “Folder found”. If the folder does not exist, create the folder, and output a message to the user stating “Folder created.” o Create a file in the user’s folder named resolutions.txt. Be sure the file is writable. Have the user type in their resolutions… when they type ‘q’, the list is done. o Ask the user to type in the path where the resolutions. txt resides. If the file is found, tell the user to hit the enter key to view the contents. If the file cannot be found, notify the user and ask if they would like to try again. o Give them three tries to type in the correct path. • Run your program until it works and the output looks nice.
Expert Answer
Answer to FOR RUBY: This is an exercise in Ruby that addresses: File Input and Output Use Text Files and Folders Topics are taken …
OR