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
KonstantinChe [14]
4 years ago
5

Task 1 – File Input

Computers and Technology
1 answer:
e-lub [12.9K]4 years ago
3 0

Answer:

Check the explanation

Explanation:

using System;

using System.IO;

                 

public class Program

{

 

  public static void Main()

  {

      string[] lines;

      Console.WriteLine("enter name of the file");

      String fileName=Console.ReadLine();

     

      Console.WriteLine("enter path of the file");

      String filePath=Console.ReadLine();

     

      using (StreamReader streamReader = File.OpenText(filePath))

      {

          String text = streamReader.ReadToEnd();

          lines = File.ReadAllLines(filePath);

      }

      Console.WriteLine("Enter path of the file to write");

      String outputFilePath = Console.ReadLine();

      bool fileExist = File.Exists(outputFilePath);

      if (fileExist)

      {      

                  overWriteOrChangeFileName(outputFilePath);          

      }

      else

      {

          File.Create(outputFilePath);

          File.WriteAllLines(outputFilePath, lines);

      }

      Console.Write("Input file Path"+filePath);

      Console.Write("output file path"+outputFilePath);

     

      void overWriteOrChangeFileName(String filePathtoCheck){

          Console.WriteLine("File exists. Do you want to overwrite the file or do you want to change the location and file name of the new file.Press Y to overwrite and press C to change the location and filename");

          String userInput=Console.ReadLine();

          if(userInput.Equals("Y")){

File.WriteAllLines(outputFilePath, lines);

          }else{

              Console.WriteLine("enter new path of the file including filename");

              String NewFileName=Console.ReadLine();

              outputFilePath=NewFileName;

              if(File.Exists(outputFilePath)){

                  overWriteOrChangeFileName(outputFilePath);                  

              }

              else

      {

          File.Create(outputFilePath);

          File.WriteAllLines(outputFilePath, lines);

      }

          }

      }

  }

 

}

You might be interested in
A new laptop was delivered to your home and left on the porch while you were at work. It is very cold outside, and you don't kno
kifflom [539]

Answer:

Let the computer warm up to room temperature before turning it on.

Explanation:

The laptop has been shipped to the user's home when he were at work and found on the deck. Outside it is really cool and he don't remember how long it has been there. Then, the user open his laptop and want to know whether it is functioning properly. Instead, let the machine warm up while switching it on to room temperature.

When a computer is still in a cold climate, they have to let it heat up to room temperature apx. 6-24 hours before switching it on. Otherwise, its heat the elements generate could cause water moisture within the laptop. That water could then harm elements of the system.

7 0
3 years ago
Yes, because it allows many users to get together and work to help project their services.
gregori [183]
Whats the question lmaoooooooooooooooooooooo
7 0
4 years ago
 A network engineer is examining a configuration implemented by a new intern who attached an IP phone to a switch port and confi
lakkis [162]
Where is the answer?????????

7 0
3 years ago
Which generation language provides a graphical environment in which the programmer uses a combination of English-like instructio
zaharov [31]

Answer:

Procedural Language.

Explanation:

The procedural language used to create a program by using a programming editor or IDE, These graphical environment help users develop programming code, and fix bugs in the code.

8 0
3 years ago
Select the correct answer.
IceJOKER [234]

Answer:

Scott should <u>"hire a coach to teach them about new technologies".</u>

Explanation:

A coach is the person that will help Mr. Scott to know about different technologies that will help him to be a good parent. This will help him to enhance his skills that are related to technologies in terms of parenting skills. Option C is the best suitable answer that help him to learn more about technology and trends.

5 0
3 years ago
Other questions:
  • Debugging is not testing, but always occurs as a consequence of testing. <br> A) TRUE<br> B) FALSE
    13·1 answer
  • Una pregunta cuales son los ataques de Sindel que por favor y me lo diga gracias
    11·1 answer
  • You are informed that all the users within the network are unable to access the Internet. You decide to start troubleshooting fr
    12·1 answer
  • A grade of B is worth Grade points<br><br><br> A) 3.0<br> B) 80<br> C)2.0<br> D)4.0
    13·2 answers
  • What is a screen tip
    6·1 answer
  • Which of these is the largest?<br> terabyte<br> exabyte<br> gigabyte<br> kilobyte<br> PLEASE HELP
    5·1 answer
  • 4.17 LAB: Varied amount of input data ( C++)
    5·1 answer
  • Match the desired outcome to the appropriate action.
    6·1 answer
  • Which of these is not a way of avoiding email fraud and scams?
    6·1 answer
  • Which type of electromagnetic wave do cell phones send and receive.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!