i. Add a function named readfile() to your program that takes a string (filename) as the parameter. You can assume that this file contains two strings on separate lines. Your function must read the file and return these two strings. ii. Add a function named assemble() that takes two string parameters (e.g., x and y). You can assume that x and y have same length. This function must create a string (e.g., z) by concatenating characters in x and y in the alternating order. That is, if x = "aceg" and y = "bdfh" then z must be abcdefgh. Your function must return z. iii. Add a function named writefile() to your program that takes two strings as parameters, a filename and one assembled string (e.g., z), in this order. Your function must write the string z in this file. This function does not return anything.

Oh no! Our experts couldn't answer your question.

Don't worry! We won't leave you hanging. Plus, we're giving you back one question for the inconvenience.

Submit your question and receive a step-by-step explanation from our experts in as fast as 30 minutes.
You have no more questions left.
Message from our expert:
Thank you for taking the time to provide feedback! Please let us know more here so we will not miss it. We have credited a question to your account.
Your Question:

i. Add a function named readfile() to your program that takes a string (filename) as the parameter. You can assume that this file contains two strings on separate lines. Your function must read the file and return these two strings.

ii. Add a function named assemble() that takes two string parameters (e.g., x and y). You can assume that x and y have same length. This function must create a string (e.g., z) by concatenating characters in x and y in the alternating order. That is, if x = "aceg" and y = "bdfh" then z must be abcdefgh. Your function must return z.

iii. Add a function named writefile() to your program that takes two strings as parameters, a filename and one assembled string (e.g., z), in this order. Your function must write the string z in this file. This function does not return anything.

Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr