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
Which one is not the part of motherboard ?<br>O Registers<br>O<br>Bus<br>O<br>Port<br>O<br>none​
Svetradugi [14.3K]

Answer:

can you expand on your question?

5 0
2 years ago
"Create a Python program named detect_column_level_data_entry_errors. When complete, you will run this program to produce a diag
11111nata11111 [884]

Answer:

See explaination

Explanation:

Code for detect_column_level_data_entry_errors.py:

# File: detect_column_level_data_entry_errors.py

# The program will produce a diagnostic report that shows data entry errors that cause column

# totals in the data to be out of balance. Will need to fix cleaned_data.txt until errors resolved.

def main():

input_filename = input('Please enter the input filename: ')

infile = open(input_filename, 'r', encoding='utf8')

total_males = 0

total_females = 0

sum_total = 0

print('\n{0:^40}'.format('Column-Level Data Entry Errors'))

print('\n{0:<10}{1:>10}{2:>10}{3:>10}'.format(

'Age Group', 'Males', 'Females', 'Total'))

for line in infile:

age_group, males, females, total = line.split()

males = int(males)

females = int(females)

total = int(total)

print('{0:<10}{1:>10,}{2:>10,}{3:>10,}'.format(

age_group, males, females, total))

if age_group != 'Total':

total_males = males + total_males

total_females = females + total_females

sum_total = total + sum_total

else:

print('{0:<10}{1:>10,}{2:>10,}{3:>10,}'.format(

'Error', (males-total_males), (females-total_females), (total-sum_total)))

infile.close()

main()

8 0
2 years ago
A call center is a _______.<br><br> JIT<br><br> CMA<br><br> CIC<br><br> SFA
sp2606 [1]

Answer: CIC

Explanation:

A call center is a customer interaction center (CIC) and it is the interface between call center agent with the customers directly. CIC are connected by the external telephone system and it uses as call center.

And the caller are basically identify by the telephone number and customer information are display in the CIC.

CIC are the modular structure for communication which include various components of CIC and framework.

4 0
3 years ago
Which of these is not one of the main parts of an email?
pav-90 [236]
The header is not a main part of the email. 
3 0
2 years ago
Read 2 more answers
Which is the most used operating system? A. Windows B.Linux C.Leopard D. DOS
Neko [114]
I think it´s either A. or  B.
7 0
3 years ago
Read 2 more answers
Other questions:
  • What daily life problems does the algorithm quicksort solve?
    14·1 answer
  • You put $500 in an interest bearing bank account that pays 2% per year but has a fee of $2 per month. Are you getting ahead?
    14·2 answers
  • The basic input/output system (bios locates the boot loader program on a linux system by reading the __________ on the hard driv
    13·1 answer
  • Write a definition of the function printDottedLine, which has no parameters and doesn't return anything. The function prints to
    14·1 answer
  • (Help please I don't know what to choose because it's both text and email but I can only pick one. HELP!!!!!!!!!!)
    6·2 answers
  • Jennifer works as a clerk in a company. The essential function of her job is typing on a keyboard. If she develops crippling art
    11·1 answer
  • Which of the following data structures can erase from its beginning or its end in O(1) time?
    15·1 answer
  • Who is your favorite smite god in Hi-Rez’s “Smite”
    14·1 answer
  • Which of the following will print I'VE GOT THIS on the screen? (5 points)
    14·1 answer
  • Refer to the image on the right. Then, using the drop-down menu, identify the correct printer type. A: inexpensive home printer
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!