Question: Problem 5A (50 points) JAVA Data format We refer to crew members by their ID numbers, which are integers between 0 and 999. Every person

Problem 5A (50 points) JAVA

Data format

We refer to crew members by their ID numbers, which are integers between 0 and 999. Every person has a unique ID; in particular, the ID of Captain Picard is 0. Some values between 0 and 999 may be unused, which means that the total number of crew members may be less than 1,000. The personnel database is a text file, which contains between 1 and 1,000 lines. Each line includes two distinct IDs, separated by a single space. The second ID specifies the supervisor of the person with the first ID. For example, the line 200 100 indicates that Person 100 is the supervisor of Person 200. Example file: 1 0 2 0 200 100 300 100 200 100 300 200

Problem 5A (50 points)

Implement a program that counts the number of crew members, that is,the number of distinct IDs in the personnel file. For instance, the file shown above includes six distinct IDs: 0, 1, 2, 100, 200, and 300.

Input and output:

Your program should input the name ofthe personnel file, and print the number of distinct IDs in the file. The file name is a string, the length of which is between 1 and 60.

Example:

Problem 5A (50 points) JAVA Data format We refer to crew members

OCommand Prompt C:homework5a Enter name of the input file: personnel.txt The crew includes 6 members

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!