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
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
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