Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Chapter 7 Programming Challenge 1 7 Starting Out With Java Tony Gladdis 4 th Edition - Must follow Templates and added specifications ADDED SPECIFICATIONS: Must
Chapter Programming Challenge Starting Out With Java Tony Gladdis th Edition Must follow Templates and added specifications ADDED SPECIFICATIONS: Must create a class ArrayD for the methods defined in the textbook.
Must add additional getAllRowTotals method to ArrayD which returns an array of answers, eg the index of the returned array is the total for row of the array passed to it
Must add additional getAllColTotals method to ArrayD which returns an array of answers, eg the index of the returned array is the total for col of the array passed to it
Must create a class ArrayDTest to exercise methods defined in ArrayD ArrayD must be usable without instances.
ArrayD methods shall assume that the arrays are of ints.
Must not have the same conceptual task coded in more than one place.
ArrayDTest has getInput method that defines the D arrays values and passes that array back to main via a return statement.
Input is hardcoded with the values, ie declare & define a row, col D array with values. I will then paste in my own set of values for testing. So code robustly, ie do NOT code assuming that the D array is x
ArrayDTest has output method that receives the D array of initial values and displays a report of the lowest, highest, total, count, and average for each array separately and displays the cumulative totals for each row and column. The data for this output will be obtained by output by directly calling the appropriate ArrayD class methods.
Have ArrayD make use of the methods of the previous assignment. TEMPLATES HERE: ARRAY DATA TEMPLATE: public class ChPcArrayDataTEMPLATE
public double getTotaldouble nums
double total nums;
for int i; i nums.length; i
total numsi;
return total;
public double getAverage double nums
double total nums;
for int i; i nums.length; i
total numsi;
return total nums.length;
public double getHighestdouble nums
double maxNum nums;
for int i; i nums.length; i
if maxNum numsi
maxNum numsi;
return maxNum;
public double getLowestdouble nums
double minNum nums;
for int i; i nums.length; i
if minNum numsi
minNum numsi;
return minNum;
ARRAY TEST TEMPLATE : import java.io;
public class ChPcArrayTestTEMPLATE
public static void mainString args
ChPcArrayDataTEMPLATE arrFunc new
ChPcArrayDataTEMPLATE;
double vals ;
System.out.printf "Total: f
Ave: f
Max: f
Min: f
arrFunc.getTotal vals
arrFunc.getAverage vals
arrFunc.getHighest vals
arrFunc.getLowest vals ;
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