Question
A sequential access file named vacations.txt contains records whose three fields are delimited by a comma. The application that uses the file defines a structure
A sequential access file named vacations.txt contains records whose three fields are delimited by a comma. The application that uses the file defines a structure named TravelInfo. The TravelInfo structure contains three members: a String member named location, an Integer member named lengthOfStay, and a Double member named cost. (4, 13, 14) a. Write a Private statement to declare a one-dimensional TravelInfo array named myVacations. The array should contain 10 elements. b. Write a Dim statement to declare a one-dimensional String array named fields. c. Write a statement that reads a line of text from the vacations.txt file and assigns the fields to the fields array. The file is associated with a StreamReader variable named inFile. d. Write the statements to assign the fields contained in the first element in the fields array to the appropriate members in the first element in the myVacationsarray.
A sequential access file named vacations.txt contains records whose three fields are delimited by a comma. The application that uses the file defines a structure named TravelInfo. The TravelInfo structure contains three members: a String member named location, an Integer member named lengthOfStay, and a Double member named cost. (4, 13, 14) a. Write a Private statement to declare a one-dimensional TravelInfo array named myVacations. The array should contain 10 elements. b. Write a Dim statement to declare a one-dimensional String array named fields. c. Write a statement that reads a line of text from the vacations.txt file and assigns the fields to the fields array. The file is associated with a StreamReader variable named inFile. d. Write the statements to assign the fields contained in the first element in the fields array to the appropriate members in the first element in the myVacationsarray.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started