Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions