Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Suppose we have a text file named persons.txt containing information about a collection of persons. A sample of the data is shown below: P01; Jane
Suppose we have a text file named persons.txt containing information about a collection of persons. A sample of the data is shown below: P01; Jane Smith; drawing, playing piano; Melbourne P02; Tom Brown; gardening; Sydney P03; Bob Carter; drinking, dancing, running; Sydney P04; Frank Dawson; playing electronic games, soccer; Melbourne A line contains the following details about a person: the person's id, name, hobbies (separated by commas), and city of residence. Write a program that reads the text file and displays on the screen the persons' details as shown in the sample below: P01 Jane Smith Melbourne 2 P02 Tom Brown Sydney 1 P03 Bob Carter Sydney 3 P04 Frank Dawson Melbourne 2 That is, for each person, the method displays The id and the name on the first line, The city of residence on the second line, and The number of hobbies on the third line
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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