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

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

I want to know jave code.

Help me to solve this...!

на
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 hasNextInt() method
• Use debugger and breakpoints to find array errors
Sample Outputs
--JGRASP exec: java SocialNet
What is the total number of friends in the network:
f
fis an incorrect input! Please enter an integer.
3
Enter name:
Jack
Enter name:
Jill
Enter name:
Bob
Jack Jill Bob
Jack 0 1 1
Jill 1 0 1
Bob
1 1 0
Total Friends Count:
Jack 2
Jill 2
Bob
2
---JGRASP exec: java SocialNet
What is the total number of friends in the network:
2
Enter name:
Cat
Enter name:
Zebra
Cat
Zebra
Cat
0 0
Zebra 0 0
Total Friends Count:
Cat 0
Zebra 0
Transcribed Image Text:на 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 hasNextInt() method • Use debugger and breakpoints to find array errors Sample Outputs --JGRASP exec: java SocialNet What is the total number of friends in the network: f fis an incorrect input! Please enter an integer. 3 Enter name: Jack Enter name: Jill Enter name: Bob Jack Jill Bob Jack 0 1 1 Jill 1 0 1 Bob 1 1 0 Total Friends Count: Jack 2 Jill 2 Bob 2 ---JGRASP exec: java SocialNet What is the total number of friends in the network: 2 Enter name: Cat Enter name: Zebra Cat Zebra Cat 0 0 Zebra 0 0 Total Friends Count: Cat 0 Zebra 0
Social Network
Тopics
String Methods, for-loop, Array, 2-D Array
Problem
You are intrigued by these social networking websites 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
each element taking a value of either 1 or 0 representing whether the person
at row i is friends with person at column j. Your program should also output
the number of friends each person has.
Procedure
1. Ask the user to enter the total number of people in the network to
create the 2-D array (There should be at least 1 person in the network).
2. Store their names in a separate array
3. We will decide 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 not friends with yourself, which means
that ArrayOfFriends[i][j] = 0, where i = j
6. Output the 2-D array to the screen (use only tabs for spacing)
7. Also output the total number of friends each person has (calculate
using the 2-D Array).
Error Handling
Transcribed Image Text:Social Network Тopics String Methods, for-loop, Array, 2-D Array Problem You are intrigued by these social networking websites 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 each element taking a value of either 1 or 0 representing whether the person at row i is friends with person at column j. Your program should also output the number of friends each person has. Procedure 1. Ask the user to enter the total number of people in the network to create the 2-D array (There should be at least 1 person in the network). 2. Store their names in a separate array 3. We will decide 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 not friends with yourself, which means that ArrayOfFriends[i][j] = 0, where i = j 6. Output the 2-D array to the screen (use only tabs for spacing) 7. Also output the total number of friends each person has (calculate using the 2-D Array). Error Handling
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Basics of loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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