Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Having trouble with this code in C#. Here is the error I get: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll Additional information: Could

Having trouble with this code in C#.

Here is the error I get:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

Additional information: Could not find file 'quote.txt'.

I am pretty the file is where it should be: C:\Users\akeene\Documents\Visual Studio 2015\Projects\Projects\FileComparison.cs\FileComparison.cs\bin\Debug\quote.txt & quote.docx

Here's my code:

using System.IO; using System;

class FileComparison { static void Main() { // creating a fileinfo object for text file FileInfo textInfo = new FileInfo("quote.txt"); // creating a fileinfo object for word file FileInfo wordInfo = new FileInfo("quote.docx");

// getting size of text file double textSize = textInfo.Length; // getting size of word file double wordSize = wordInfo.Length;

// print the size of text file Console.WriteLine("Size of text file is " + textSize); // print the size of word file Console.WriteLine("Size of word file is " + wordSize);

// print the ratio of file sizes to each other Console.WriteLine("Ratio of text file size to word file size " + textSize / wordSize); Console.WriteLine("Ratio of word file size to text file size " + wordSize / textSize); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions