Given an array as follows long [] [] nums = {{1,2,3,4,5}, {6,7,8,9}, {10,11,12,13,14,15}, {16,17,18,19,20}, {21,22,23,24,25}}; Build the
Question:
Given an array as follows
long [] [] nums = {{1,2,3,4,5}, {6,7,8,9}, {10,11,12,13,14,15}, {16,17,18,19,20}, {21,22,23,24,25}};
Build the following methods: 1) calcTotal:The method should accept a two-dimensional array as an argument and return the total of all the values in the array.
2) calcAverage:The method should accept a two-dimensional array as an argument and return the average of all the values in the array.
3) calcRowAverage:The method should accept two parameters: 1) a two-dimensional array as an argument and 2) an integer that represents a row number for calculations. Return the average of all the values in that row in the array.
Problem 2
Two arrays are given:
String cars[]={"Honda Accord", "Chevrolet Suburban", "Dodge Charger", "Kia Optima", "Acura TLX"}; integer prices[]={17000, 48000, 24000, 22500, 17999};
Write a method that finds the cheapest car name, and returns back a String stating what the car name is and how much it costs. The method should take two arrays as two parameters (you do not need to make a two dimensional array out of these arrays).
Call this method from main(), receive the result, and show the result
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis