1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
fomenos
3 years ago
13

Suppose there is a text file named "datafile.txt with some data in the root directory of your computer". Using your choice of la

nguage, C#, Java, or pseudocode, write code that (i) opens the file in read mode; (ii) displays the file content on the monitor screen; (iii) uses exception handling mechanism; and (iv) safely closes the file. You don't need to write the main() method.
Computers and Technology
1 answer:
aivan3 [116]3 years ago
6 0

Answer:

See explaination for program code

Explanation:

code below

using System;

using System.IO;

namespace ReadAndDisplayFileCOnsole

{

class Program

{

static void Main(string[] args)

{

using (StreamReader reader = new StreamReader("D:\\datafile.txt"))

{

while (true)

{

string line = reader.ReadLine();

if (line == null)

{

break;

}

Console.WriteLine(line);

}

reader.Close();

Console.Read();

}

}

}

}

You might be interested in
Which feature of vitualization helps increase the IT productivity of a business?
laila [671]
A the answer is yes
7 0
3 years ago
The acronym LAH stands for
Nina [5.8K]
D.Limited Access Highway
5 0
4 years ago
Read 2 more answers
If a 9V, 7W radio is on from 9am to 12pm. Calculate the amount of charge that flows through it, hence or otherwise the total num
vredina [299]

Answer:

Q=It

and

p=IV

Given, v=9V P= 7W

I=P/V

I =7/9

Also, time(t) from 9am to 12pm is 3hrs

Converting into sec =3×3600

t=10800

Q= 7/9 ×10800

Q =8400C

6 0
3 years ago
Linda wants to change the color of the SmartArt that she has used in her spreadsheet. To do so, she clicks on the shape in the S
Julli [10]

Answer: Theme colors

Explanation:

Based on the directions, Linda most probably went to the "Theme colors" option as shown in the attachment below. Theme colors enables one to change the color of their smart shape.

It is located in the "Format tab" which is under "Drawing tools" in the more recent Excel versions. Under the format tab it is located in the Shape Styles group as shown below.

8 0
3 years ago
From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.
Colt1911 [192]

Answer:

True: In binary search algorithm, we follow the below steps sequentially:

Input: A sorted array  B[1,2,...n] of n items and one item x to be searched.

Output: The index of x in B if exists in B, 0 otherwise.

  1. low=1
  2. high=n
  3. while( low < high )
  4.  {      mid=low + (high-low)/2
  5.         if( B[mid]==x)
  6.          {
  7.             return(mid)  //returns mid as the index of x
  8.           }
  9.          else
  10.          {
  11.              if( B[mid] < x)      //takes only right half of the array
  12.               {
  13.                 low=mid+1
  14.               }
  15.              else               // takes only the left half of the array
  16.               {
  17.                high=mid-1
  18.               }
  19.           }
  20.  }
  21. return( 0 )

Explanation:

For each iteration the line number 11 or line number 15 will be executed.

Both lines, cut the array size to half of it and takes as the input for next iteration.

6 0
4 years ago
Other questions:
  • convert the following c code to mips. assume the address of base array is associated with $s0, n is associated with $s1, positio
    14·1 answer
  • What can you do to make sure you have a healthy credit report
    13·2 answers
  • Encyclopedia.com is considered to be
    15·1 answer
  • Cliff just started working with a client who has a very disorganized AdWords account. What’s an effective way for him to begin r
    15·1 answer
  • Which of the following is a non timber forest product
    7·1 answer
  • A computer processes data using only 1s and 0s true or false?
    9·2 answers
  • What is the most recent version of Microsoft Windows?
    12·2 answers
  • What is an automatic update and when should you use it
    10·1 answer
  • To stored three characters a computer occupies. Bytes memory space
    11·1 answer
  • Frequently used _____________ can be saved as _____________ for use in analysis, dashboards, reports, tickets, and alerts.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!