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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education