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]
3 years ago
5

Task 1 – File Input

Computers and Technology
1 answer:
e-lub [12.9K]3 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
In this exercise, you will write a class that represents how you spend your time during the week The class should have four doub
Nuetrik [128]

Answer:

Answered below

Explanation:

# Program is written in Java

class WeekHours{

double school;

double fun;

double sleep;

double sports;

WeekHours( ){

school = 0.0;

fun = 0.0;

sleep = 0.0;

sports = 0.0;

}

public void setSchool ( double x){

school = x;

}

public void setFun( double y){

fun = y;

}

public void setSleep( double w){

sleep = w;

}

public void setSports( double z){

sports = z;

}

public void totalHours(){

double tHours = school + fun + sleep + sports;

System.out.print(tHours);

}

}

4 0
3 years ago
question 2 you are using a spreadsheet to organize a list of upcoming home repairs. column a contains the list of repairs, and c
Helga [31]

Since you are using a spreadsheet to organize a list of upcoming home repairs. The spreadsheet tool that can you use to create a drop-down list of priorities for each cell in column b is  Data validation.

<h3>What is the purpose of data validation?</h3>

The use of rows and columns of data, a spreadsheet is a type of computer program that can store, display, and manipulate data. One of the most used tools that can be used with personal computers is a spreadsheet. A spreadsheet is typically made to store numerical data and brief text passages.

Therefore, in the context of the above, before using data for a business operation, it is best to validate it to ensure its accuracy, integrity, and structure. The output of a data validation operation can be used to generate data for business intelligence, data analytics, or training a machine learning model.

Learn more about spreadsheet from

brainly.com/question/4965119
#SPJ1

6 0
9 months ago
Write a new function called "listmax" based on the following IPO # function: listmax # INPUT: a list # PROCESSING: obtains the l
hammer [34]

Answer:

See Explaination

Explanation:

def listmax(lst):

largest = None

for num in lst:

if largest is None or num > largest:

largest = num

return largest

mylist = [10, 20, 30]

x = listmax(mylist)

print(x)

5 0
3 years ago
What isthe history of technology from the 1980s to now and how is it used in classrooms?.?. PLEASE HELP
AlladinOne [14]

Answer:

Technology has a prestigious history. It took years for the technology to come up and prove its essence.

The Internet, World Wide Web, the development of websites, the introduction of Wikipedia and its evolution marks the golden period on 1980s which was followed by launch of certain search engines like google, bing, duckduck go and may more which made the surfing more easy and fun. Then further the launch of android phones and iPhones  brought up another revolution in technology.

Nowadays, technology finds its use almost everywhere. Talking about the classrooms, students resort to internet for exploring studies, topics, projects and much more. The use of Wikipedia has reached a whole new level. Teachers tend to provide assignments over the internet only in order to increase the exposure and reduce the use of paper which works in the collective good of both internet and nature!

3 0
3 years ago
Which of the following definitions describes the term electrocution? A. A reflex response to the passage of electric current thr
Zarrin [17]
Basically, electrocution is the use of electric shock in order to kill someone. Based on the given statements above, the one that is synonymous with this definition is option C. This is when a high amount of electrical energy is being exposed to someone. Hope this helps.
5 0
3 years ago
Other questions:
  • What do u call a individual that loves motor bikes and leather and is in a rival group known as mods?
    5·1 answer
  • If you want to conserve ink or toner, you can instruct PowerPoint to print ____ documents.
    10·1 answer
  • When creating a scene in Blender, you should change Blender Render to ______ to create the best lighting option?
    15·1 answer
  • What is not a common purpose for a research report?
    5·2 answers
  • Select the tips you should follow when writing a business report.
    12·1 answer
  • - Which amongst the following is not a Characteristic of Cloud Computing?
    5·1 answer
  • NBA bank uses centralized client server database that is accessed by all its nationwide branches. All customers' records are sto
    14·1 answer
  • Jiz<br>Active<br>2<br>3<br>- 2(7 - 15)<br>What is the value of<br>4​
    10·2 answers
  • C++ Write a program that initially asks a user to enter two positive integer numbers a and b. If either a or are zero or negativ
    9·2 answers
  • Chris is working with other employees on a worksheet. the other employees have made comments, but they are not visible.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!