Create a file that contains your favorite movie quote. Use a text editor such as
ID: 1267786 • Letter: C
Question
Create a file that contains your favorite movie quote. Use a text editor such as Notepad and save the file as Quote.txt. Copy the file contents and paste them into a word-processing program such as Word. Save the file as Quote.doc. Write console application that displays the sizes of the two files as well as the ratio of their sizes to each other. To discover a file's size, you can create a System.IO.FileInfo object using a statement such as the following, where FILE_NAME is a string that contains the name of the file:
Explanation / Answer
Create the two files as described.
Use FileInfo to get the the size of each file.
Display the file name and it's size.
Calculate the ratio of the sizes (either txt/doc or doc/txt, your choice). Be aware that int/int will not result in a good ratio, so convert the values to doubles first.
Display the ratio, making sure you tell which of the above you choose.
It's about 6 lines of code.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.