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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started