Question: JAVA Language - Skeleton is posted below. Spreadsheet.java import java.util.Scanner; /** * Spreadsheet Skeleton File * For use with the Spreadsheet HW in 161, this

JAVA Language - Skeleton is posted below.

JAVA Language - Skeleton is posted below. Spreadsheet.java import java.util.Scanner; /** *Spreadsheet Skeleton File * For use with the Spreadsheet HW in 161,this assignment has you build methods * that do work on 2-dimensionalarrays and produce calculations similar to what * you would find inExcel. * * Don't rename these methods, or change their input oroutput values - use this * template to get you started. You

Spreadsheet.java

import java.util.Scanner;

/**

* Spreadsheet Skeleton File

* For use with the Spreadsheet HW in 161, this assignment has you build methods

* that do work on 2-dimensional arrays and produce calculations similar to what

* you would find in Excel.

*

* Don't rename these methods, or change their input or output values - use this

* template to get you started. You are free to add additional methods and data

* as you see fit.

*

*/

public class Spreadsheet{

//Declaring variables as static globals is usually bad design. Do *NOT* use this strategy in future assignments.

public static double[][] spreadsheet;

public static int size = 2;

public static DecimalFormat spreadsheetFormat = new DecimalFormat("Pattern");

public static void main(String[] args) {

/eed some scanner data here

int input;

initializeSpreadsheet();

while(true) {

printSpreadsheet();

System.out.println("(1) Input (2) Row Sum (3) Col Sum (4) Row Ave (5) Col Ave (6) Sum (7) Average (8) Quit");

//get the next operation from the user

switch(input) {

case 1:

case 2:

case 3:

case 4:

case 5:

case 6:

case 7:

case 8:

System.out.println("Good bye!");

System.exit(0);

break;

default:

System.out.println("Unrecognized command. Please try again!");

}

}

}

public static void initializeSpreadsheet(){

//todo

}

public static void inputData(int x, int y, double value){

//todo

}

public static double sumTotal() {

double sum = 0;

//todo

return sum;

}

public static double sumRow(int targetRow) {

double sum = 0;

//todo

return sum;

}

public static double sumCol(int targetCol) {

double sum = 0;

//todo

return sum;

}

public static double rowAve(int targetRow) {

}

public static double colAve(int targetCol) {

}

public static double average() {

}

public static void printSpreadsheet() {

//todo: use printf to format your spreadsheet string to only have 2 digits to the right of the mantissa

//i.e. only have 2 digits representing the fractional part of the number

}

}

Summary Build a program that will provide spreadsheet style data processing of a matrix of numbers. Your software will allow users to take the sum and average of specific rows or columns, and also calculate the sum and average of the whole spreadsheet

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 Databases Questions!