1
Java / creating a spreadsheet
« on: July 01, 2015, 04:10:34 pm »
I may be going about this the wrong way, but here's the goal:
I want to populate specific fields (that are color keyed) in a spreadsheet with both the figures input by the user and the solutions made by those inputs. The spreadsheet does not have to be interactive. I am attempting to make the CSV writer utility work, but I need the information to go to a specific field in an already created spreadsheet; I can't find the syntax for this. Here's my test program:
I want to populate specific fields (that are color keyed) in a spreadsheet with both the figures input by the user and the solutions made by those inputs. The spreadsheet does not have to be interactive. I am attempting to make the CSV writer utility work, but I need the information to go to a specific field in an already created spreadsheet; I can't find the syntax for this. Here's my test program:
Code: [Select]
/*
Test program to generate spreadsheet.
*/
import java.util.Scanner;
class TestRecord {
String name;
double a;
double b;
double calc_average() {
double x = (a+b) / 2;
System.out.println("The average is " + x);
return x;
}
}
class SheetGenerator {
public static void main(String[] args) {
TestRecord dingdong = new TestRecord();
double calculatedAverage;
Scanner in = new Scanner(System.in);
dingdong.name = "Dipity";
System.out.println("Enter the value the numbers for " + dingdong.name);
System.out.println();
System.out.println("Enter the value for a: ");
dingdong.a = in.nextDouble();
System.out.println("Enter the value for b: ");
dingdong.b = in.nextDouble();
calculatedAverage = dingdong.calc_average();
}
}