Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Virtuous Crisis Undertakings ( VCU ) is a disaster relief organization that helps distribute supplies to disaster ridden areas. They are currently looking for cargo
Virtuous Crisis Undertakings VCU is a disaster relief organization that helps distribute supplies to disaster ridden areas. They are currently looking for cargo planes that can replace their current fleet while maintaining their current running costs. You will write a program that will accept, at the command line, two Strings, one containing various plane efficiency metrics, and another containing the values of these metrics A sample of the two strings are below:
mpgvolumecapacity,weightcapacity,maintenancecosts,landingdistance,lifespan
The aircraft efficiency metrics in the first string are separated by a symbol. The values found in the second string are separated into a twodimensional grid by the symbol and separated into each column by a symbol.
The first method is the getMetrics method. This method takes in a String of aircraft efficiency metrics and returns a onedimensional String array containing the list of elements. You can use the String method split to split your string based on the character separating the categories. Here is the method header.
public static String getMetricsString efficiencyMetrics
Your code here
The second method is the getPlaneData method. This method takes in a String of plane data and returns a twodimensional double array containing the efficiency metric values for each metric for each plane from the string passed in Again, you can use the String method splitString to split your string based on the char character you specify. You will need to split this string on the and symbols. Here is the method header.
public static double getPlaneDataString
planes
Your code here
Here is an example of the two arrays that are created from the two methods. Note the twodimensional array will just contain the plane metric values. This is just an example of the data that might be used to test your code. The efficiency metrics and their order will not change. However, the plane data values will change, but will always be numerically labeled starting with the number
mpg
volumecapacity
weightcapacity
maintenancecosts
landingdistance
lifespan
mpg
volumecapacity
weightcapacity
maintenancecosts
landingdistance
lifespan
Plane
Plane
Plane
Plane
Plane
Plane
The third method is the findPlaneViability method. This method takes in a D double array of efficiency metrics. It will search each plane for the ones that achieve adequate viability. The formula for running cost is as follows:
viability mpg maintenanceCostslifespanvolumeCapacityweightCapacitylandingDistance
The criteria value that needs to be attained is: If this criteria value is attained or surpassed, then the plane number is returned in an int array. Since not all planes may meet the criteria, the array returned should be resized so that it only contains the values that meet the criteria with no extra data. Using the data above as an example, if rows and all have a viability score greater than so findPlaneViability would return the array and no other extra values probably need to double check these calculations
public static int findPlaneViabilitydouble planes
Your code here
The fourth method is the searchHighestPlaneMetric method. This method takes in a D double array of plane efficiency metric values, a String array of metrics, and a plane number. Remember a plane number is one off from its index in the array It will search the given plane for its two highest value metrics and will return a string containing their metrics in the order of highest metric first, second highest metric second with spaces and the word and connecting them. iempg and volumecapacity
public static String searchHighestMetricdouble
planes, String metrics, int planeNumber
Your code here
The fifth method is the searchHighestPlane method. This method takes in a D double array of plane efficiency metric values, a String array of metrics, and a single efficiency metric name. It will search for and return the plane number of the plane which contains the highest efficiency metric value for the given efficiency metric.
public static int searchHighestPlanedouble
planes, String metrics, String metric
Your code 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