Please help me to solve it. I want to know the java code...

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please help me to solve it.

I want to know the java code...

Sample Outputs
---JGRASP exee: java soeialNet
What is the total number of triends in the network
fis an incorrect inputt Please enter an integer.
Enter name:
Jack
Enter name:
Jill
Enter nane
Bob
Jack Jill Bob
Jack 0 11
Jill 1 0L
Bob 1 1
Total Frienda counti
Jack 2
Jill 2
Bob 2
----GRASP exee: java SocialNet
What is the total number of friends in the networki
2
Enter name
Cat
Enter name:
lebra
Cat sebra
Cat o 0
Zebra o o
Total Friends Count:
Cat
Zebra 0
Transcribed Image Text:Sample Outputs ---JGRASP exee: java soeialNet What is the total number of triends in the network fis an incorrect inputt Please enter an integer. Enter name: Jack Enter name: Jill Enter nane Bob Jack Jill Bob Jack 0 11 Jill 1 0L Bob 1 1 Total Frienda counti Jack 2 Jill 2 Bob 2 ----GRASP exee: java SocialNet What is the total number of friends in the networki 2 Enter name Cat Enter name: lebra Cat sebra Cat o 0 Zebra o o Total Friends Count: Cat Zebra 0
Topics
String Methods, for-loop, Array, 2-D Aray
Problem
You are intrigued by these social networking wobsites and want to know how
they work. You started with figuring out your school's social network. You
want to know who is friends with who and how many friends each person
has. Write a program that shows a two dimensional array of friends where
cach element taking a value of either I or representing whether the person
at row i is friends with person at column j. Your program should also output
the mumber of friends each person has.
Procedure
1. Ask the user to enter the total mamber of people in the network to
crente the 2-D array (There should be at kast I person in the network).
2. Store their names in a separate array
3. We will decikle whether one person is friends with another if their
names lexicographic difference is not greater than 12
4. Populate the 2-D array with 1 representing row i and column j being
friends and 0 representing row i and column j not being friends
5. You should assume that you are ot friends with yourself, which means
that ArrayOfviendafil -0, where i = j
6. Output the 2-D aray to the sereen (use only tabs for spacing)
7. Also output the total mumber of friends each person has (calculate
using the 2-D Array).
Error Handling
Your code should handle user input errors using loops. For example, if they
enter strings like "jane" when you are expecting an integer, you should tell
the user to enter the correct input. See sample outputs. Same applies for
total number of people in the network.
Hints
• Math.abs() method
• String's compareTo method
• Scanner's hasNextlnt() method
• Use debugger and brenkpoints to find array errors
Transcribed Image Text:Topics String Methods, for-loop, Array, 2-D Aray Problem You are intrigued by these social networking wobsites and want to know how they work. You started with figuring out your school's social network. You want to know who is friends with who and how many friends each person has. Write a program that shows a two dimensional array of friends where cach element taking a value of either I or representing whether the person at row i is friends with person at column j. Your program should also output the mumber of friends each person has. Procedure 1. Ask the user to enter the total mamber of people in the network to crente the 2-D array (There should be at kast I person in the network). 2. Store their names in a separate array 3. We will decikle whether one person is friends with another if their names lexicographic difference is not greater than 12 4. Populate the 2-D array with 1 representing row i and column j being friends and 0 representing row i and column j not being friends 5. You should assume that you are ot friends with yourself, which means that ArrayOfviendafil -0, where i = j 6. Output the 2-D aray to the sereen (use only tabs for spacing) 7. Also output the total mumber of friends each person has (calculate using the 2-D Array). Error Handling Your code should handle user input errors using loops. For example, if they enter strings like "jane" when you are expecting an integer, you should tell the user to enter the correct input. See sample outputs. Same applies for total number of people in the network. Hints • Math.abs() method • String's compareTo method • Scanner's hasNextlnt() method • Use debugger and brenkpoints to find array errors
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY