subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
Page orientation can be either landscape or
Answers: 1
question
Computers and Technology, 21.06.2019 19:30
Raveena is making a professional presentation for a newly launched product of her company. she wants to incorporate the following features in her presentation. a) to add serial numbers in each slide b) to add name of her company on top of each slide. c) to add the picture of her product on the second slide(the picture of her product is stored on her computer) write the commands/features of her presentation tool using which she can perform the above operations.
Answers: 2
question
Computers and Technology, 21.06.2019 22:00
You should try to photograph people on bright sunny days because the light will be best a) true b) false
Answers: 1
question
Computers and Technology, 22.06.2019 07:20
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display “enter a value to be cubed.” input value; set cube = value ^ 3 display value, “ cubed is “, cube end while
Answers: 2
You know the right answer?
Task 1 – File Input

The first piece of information we need is a text file’s name and lo...
Questions
question
Mathematics, 18.05.2020 09:57
question
Advanced Placement (AP), 18.05.2020 09:57
question
Mathematics, 18.05.2020 09:57
question
Mathematics, 18.05.2020 10:57
Questions on the website: 13722363