Question

In: Physics

c# only please Objectives Use the more advanced data structures introduced to accomplish a difficult problem....

c# only please

Objectives

  • Use the more advanced data structures introduced to accomplish a difficult problem.

Tasks

This assignment has two parts:

  1. Read from a file.
  2. Write to a file.

Task 1 – File Input

The first piece of information we need is a text file’s name and location. Ask the user through the console what the file’s name and location are. After that, please ensure that the file does exist and at the given location. If the file does not exist or cannot be read, please return a message to the user stating that and ask them to enter another name and location.

Finally, if the file can be read then simply copy/read every line from the file. The contents of this file will be used in the next task.

Task 2 – File Output

Ask the user, through the console, what the name of the copy of the previous file should be called and where it should be saved. Check to see if a file with the same name already exists at the location given and if one does ask the user if they want to overwrite the file that already exists or if they would like to change the name and location of the new file. If they wish to change the name and location, go through the process of getting their input again through the console and checking if the newly given name and location are taken already too.

If they want to overwrite or no file already exists in the given location with the given name, then place the copied contents of the file that was read in the first task into this new file.

After successfully copying the contents of the first file into the second file, print to the console the name and location of both of those files.

A sample text file named “textfile.txt” has been supplied in case you need a file to test the above code on. The contents of that file is the declaration of independence.

∃ Some Sample Output:

Please enter a text file name and location:

C:\Users\source\repos\1322L_Assignment6\bin\Debug\textfiladsfe.txt22

This file does not exist!

Please enter a text file name and location:

C:\Users\source\repos\1322L_Assignment6\bin\Debug\textfile.txt

Please enter a new file name and location:

C:\Users\source\repos\1322L_Assignment6\bin\Debug\DeclarationOfIndependence.txt

A file already exists with that name!

Would you like to overwrite it or enter a different name? (0 or 1) 0

The file will be overwritten.

The file “C:\Users\source\repos\1322L_Assignment6\bin\Debug\textfile.txt” has been copied to “C:\Users\source\repos\1322L_Assignment6\bin\Debug\DeclarationOfIndependence.txt”.

Solutions

Expert Solution


Related Solutions

THE STRING MATCH PROBLEM C++ only. Must use loops. Please do not use sequence of if...
THE STRING MATCH PROBLEM C++ only. Must use loops. Please do not use sequence of if statements. . Given 2 strings, a and b, set result to the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", "aa", and "az" substrings appear in the same place in both strings. • for input of "xxcaazz", "xxbaaz" → 3 • for input of "abc", "abc" → 2 • for input...
Objectives: Practice using selection structures within a complete C++ program to solve a problem. Be able...
Objectives: Practice using selection structures within a complete C++ program to solve a problem. Be able to understand and use linear interpolation in a program. Modify/Extend an existing program. Problem Description: Linear Interpolation There are two credit levels for this assignment. Completing the “B” level correctly is worth 16/20 points, completing the “A” level is worth 20/20. You are encouraged to get the code for the “B” level working first and then complete the “A” level if you have time/interest....
Use excel only, please! problem #1 data contains data on automobile manufacturer who employs sales representatives...
Use excel only, please! problem #1 data contains data on automobile manufacturer who employs sales representatives who make calls on dealers. The manufacturer wishes to compare the effectiveness of four different call-frequency plans for the sales representatives. Thirty-two representatives are chosen at random from the sales force and randomly assigned to the four call plans for six months, and their sales for the 6-month study period are recorded. Do the sample data support the hypothesis that at least one of...
Please consider the following data. The data will be used for the entire problem. Only move...
Please consider the following data. The data will be used for the entire problem. Only move forward the viable investments to the next capital rationing model. Meaning if the investment passes the capital rationing test, put that investment into the next model. i.e. if one of the investments doesn’t pass the payback test, don’t move it forward to ROR. Bonnet Corporation is considering 8 different investments. Here is the data for the 8 investments: McCoy Stede Rackham Lavasseur Anthos Investment...
This assignment uses data structures, selection, use, control structures, logic, computation, file I/O, etc. In C++...
This assignment uses data structures, selection, use, control structures, logic, computation, file I/O, etc. In C++ There should be 3 files for the project: theMain.cpp, dateClass.h, dateClass.cpp (or similar file names) For input/output. Read at least 10 dates in a data file set up this way: The first number is the number of data items in the file. Then after that, each row is one date in the format month day year. here is a sample data file of 6...
You are required to use only C for this problem. To begin, instead of using two...
You are required to use only C for this problem. To begin, instead of using two different variables for this problem, you are going to define a structure with two members; one representing the feet and the other one representing the inches. We will also use three functions; one to initialize a structure, one to check the validity of its values, and the last one to print them out. First, define your structure. Next, declare a structure of this type...
Be sure to use only C for the Programming Language in this problem. Before we start...
Be sure to use only C for the Programming Language in this problem. Before we start this, it is imperative that you understand the words “define”, “declare” and “initialize” in context of programming. It's going to help you a lot when following the guidelines below. Let's begin! Define two different structures at the top of your program. be sure to define each structure with exactly three members (each member has to be a different datatype). You may set them up...
This problem is based on the JA Tires data that was first introduced in problem 6-35....
This problem is based on the JA Tires data that was first introduced in problem 6-35. If you have not already accessed the data, it can be downloaded from the textbook website. As part of risk assessment procedures, you have been asked to perform some preliminary data analytics on the sales file to assess whether individual transactions or classes of sales transactions represent increased inherent risk because they are large, unusual, or involve related parties. You can perform this analysis...
Instructions: 1. Please use only C as the language of programming. 2. Please submit the following:...
Instructions: 1. Please use only C as the language of programming. 2. Please submit the following: (1) the client and the server source files each (2) a brief Readme le that shows the usage of the program. 3. Please appropriately comment your program and name all the identifiers suitable, to enable enhanced readability of the code. Problem: Write an ftp client and an ftp server such that the client sends a request to ftp server for downloading a file. The...
The assignment: C++ program or Java You need to use the following programming constructs/data structures on...
The assignment: C++ program or Java You need to use the following programming constructs/data structures on this assignment. 1. A structure named student which contains:   a. int ID; student id; b. last name; // as either array of char or a string c. double GPA;    2. An input file containing the information of at least 10 students. 3. An array of struct: read the student information from the input file into the array. 4. A stack: you can use the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT