Lab Goal : This lab was designed to teach you how to use a Map. Lab Description : Take list of people and to whom each person is related. Then, build a list for each person and all of the people related to that person.

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter7: Input/output Technology
Section: Chapter Questions
Problem 26VE
icon
Related questions
Question

Please do this in JAVA PROGRAMMING

Note: The attached images are the instructions and the target output

 

 

 

relatives.dat file in text:

14

Jim Sally

Fred Alice

Jim Tom

Jim Tammy

Bob John

Dot Fred

Dot Tom

Dot Chuck

Bob Tom

Fred James

Timmy Amanda

Almas Brian

Elton Linh

Dot Jason

Dot

 

 

 

Relatives.java reference file:

import java.util.Map;

import java.util.Set;

import java.util.TreeMap;

import java.util.TreeSet;

import java.util.Scanner;

import static java.lang.System.*;

 

public class Relatives

{

         private Map<String,Set<String>> map;

 

         public Relatives()

         {

 

 

 

         }

 

         public void setPersonRelative(String line)

         {

                 String[] personRelative = line.split(" ");

 

 

 

 

 

 

 

 

 

 

         }

 

 

         public String getRelatives(String person)

         {

                 return "";

         }

 

 

         public String toString()

         {

                 String output="";

 

 

 

 

 

 

 

 

                 return output;

         }

}

 

RelativesRunner.java reference file:

import java.io.File;

import java.io.IOException;

import java.util.Scanner;

import static java.lang.System.*;

 

public class RelativesRunner

{

         public static void main( String args[] ) throws IOException

         {

                 //add more test cases            

         }

}

Lab Goal : This lab was designed to teach you how to use a Map.
Lab Description : Take list of people and to whom each person is related. Then, build a list for each
person and all of the people related to that person.
Files Needed ::
Sample Data :
Relatives.java
RelativesRunner.java
14
Jim Sally
relatives.dat
Fred Alice
Jim Tom
Jim Tammy
Bob John
algorithm help
Dot Fred
Dot Tom
Dot Chuck
This program must be written using a Map of Sets.
Bob Tom
Fred James
Timmy Amanda
private Map<String,Set<String>> map;
Almas Brian
The Map will store the key( person ) and a value(Set
of the people related to that person).
Elton Linh
Dot Jason
Dot
Transcribed Image Text:Lab Goal : This lab was designed to teach you how to use a Map. Lab Description : Take list of people and to whom each person is related. Then, build a list for each person and all of the people related to that person. Files Needed :: Sample Data : Relatives.java RelativesRunner.java 14 Jim Sally relatives.dat Fred Alice Jim Tom Jim Tammy Bob John algorithm help Dot Fred Dot Tom Dot Chuck This program must be written using a Map of Sets. Bob Tom Fred James Timmy Amanda private Map<String,Set<String>> map; Almas Brian The Map will store the key( person ) and a value(Set of the people related to that person). Elton Linh Dot Jason Dot
A Bluel: Terminal Window - Maps
Options
Tammy is related to: Jim
James is related to: Fred
Alice is related to: Fred
John is related to: Bob
Dot is related to: Chuck Fred Jason Tom
Fred is related to: Alice Dot James
Amanda is related to: Timmy
Jim is related to: Sally Tammy Tom
Brian is related to: Almas
Almas is related to: Brian
Tom is related to: Bob Dot Jim
Elton is related to: Linh
Linh is related to: Elton
Sally is related to: Jim
Bob is related to: John Tom
Timmy is related to: Amanda
Chuck is related to: Dot
Jason is related to: Dot
Transcribed Image Text:A Bluel: Terminal Window - Maps Options Tammy is related to: Jim James is related to: Fred Alice is related to: Fred John is related to: Bob Dot is related to: Chuck Fred Jason Tom Fred is related to: Alice Dot James Amanda is related to: Timmy Jim is related to: Sally Tammy Tom Brian is related to: Almas Almas is related to: Brian Tom is related to: Bob Dot Jim Elton is related to: Linh Linh is related to: Elton Sally is related to: Jim Bob is related to: John Tom Timmy is related to: Amanda Chuck is related to: Dot Jason is related to: Dot
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning