Question: Java - Write a method which will receive an array of integers. Each number in the array represents the count of passengers at a particular

Java -

Write a method which will receive an array of integers. Each number in the array represents the count of passengers at a particular train station.

The method will check each count and record the traffic flow as follow:

- if the count is less than 0, the traffic flow is "Invalid";

- if the count is between 0 and 100, the traffic flow is "Low";

- if the count is more than 100, the traffic flow is "High".

The traffic flow will be stored in a new array and returned to the caller upon method completion.

You may assume the array is not empty. You can make use of the following code snippet to write your answer

-----------------------------------------------------------------

public static String [ ] getTrafficSummary (int [ ] data)

{

//write your answer here

}

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!