Problem 1A two-dimensional integer array namedsalesholds the weekly sales for employees in a jewelry store for a year. Implement a method namedsalesRange()that returns a single value representing the...







Problem 1A two-dimensional integer array namedsalesholds the weekly sales for employees in a jewelry store for a year. Implement a method namedsalesRange()


that returns a single value representing the range of sales held in the array, i.e. the value of the highest sales amount minus the value of the lowest amount. The method takes a two-dimensional array of integersnamed


sales



,as a parameter.(For example, if sales holds the values below:
200 350 400
150 375 225
the method should return 250.







Problem 2Implement a method nameddieStats(). The method takes a two-dimensional array of Die objects, named,dice. The method rolls each die in dice and returns an array of integers, where each integer represents the number of Die objects in each row that land in an odd number.




For example, if the rolled dice in a 2x3 array land in
2 4 6
3 4 5
the method would return [0, 2]. (For testing, use a 2x3 Die array and print the elements of the returned array)







Problem 3Implement arecursivemethodprintDigits()that takes an integernumas a parameter and prints its digits, one digit per line.




For example, the output for the method call printDigits(23147) would display




2
3
1
4
7







Problem 4Implement arecursivemethod prodArray() that returns the product of the first few numbers in the array. The method takes two parameters:







  1. a non-empty integer array, numArray






  2. count


    ,a positive integer representing the number of entries in array to multiply, no more than size of the array.






You may assume valid parameters. For example,




int[] a ={1,3,2,5};
System.out.println(prodArray(a,3)); //will display 6
System.out.println(prodArray(a,4)); //will display 30
















Problem 5Embed and test all methods above in a program,TestArraysAndRecursion,by using examples and/or instructions given in each problem.




Mar 22, 2023
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here