Question: Create a class SodaSurvey that implements SodaSurveyInterface.java. The SodaSurvey class will contain and process a 2 D int array with rows corresponding to people and

Create a class SodaSurvey that implements SodaSurveyInterface.java.
The SodaSurvey class will contain and process a 2D int array with rows corresponding to people and
columns corresponding to sodas, as read from an input text file. The 2D array should be the ONLY instance
variable. Use .length in all code to get array dimensions. There should be no ArrayLists anywhere in this
program.
Use the following header for SodaSurvey: public class SodaSurvey implements SodaSurveyInterface {}
SodaSurvey must have one constructor that takes in an input filename as a String argument: public
SodaSurvey( String filename){}
Use a Scanner to read in each row. You have a choice for how to process each line. You can use a second
Scanner or you can use String .split() to break each row into a String[] of column values. Convert Strings to
ints with Integer.parselnt()
Implement all methods as described in the SodaSurveylnterface method javadocs
The toString() method should return a String formatted as shown in the sample output above and in the
interface javadoc for toString(). Format averages to two decimal places.
SodaSurveyInterface contains:
public double rowAvg(int rowIndex);
public double colAvg(int colIndex);
Create a driver class (with main() method) called SodaDriver.java.
SodaSurveyDriver will get an input filename passed as a command-line argument to String[] args. There
should be NO other user interaction via prompts or input from the keyboard.
Validate that a command line argument was received. If the program was launched without a command-line
argument report the problem with a message to the console and exit.
Create a SodaSurvey object using the filename. Test the functionality of all SodaSurveylnterface methods.
Thoroughly test SodaSurvey. Sample sessions should look like the following:$ java SodaSurveyDriver
Usage: java SodaSurveyDriver filename
$
$ java SodaSurveyDriver Survey1. dat
Testing rowAvg (0):3.5
Testing rowAvg(1): 3.0
Testing colAvg(0)
Create a class SodaSurvey that implements

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!