0
我可能要对这个错误的方式,但这里的目标:如何使用Java填充预先设计的电子表格?
我想填充特定字段(这些颜色键控)在一个电子表格,由用户输入两个数字和那些做出的解决方案投入。电子表格不必是交互式的。实质上,(无法找到解决方案)我试图将变量传递到电子表格中的特定单元格。我可以通过Access或Excel来实现,但这是较大应用程序的一小部分。如果它有帮助,最终,用户输入和计算需要存储在数据库中并按日期组织/键入;每天都会有新的输入和计算。这里是我的测试程序:
/*
Test program to generate spreadsheet and populate specific cells
with the scanner inputs from the user and the solution derived
from scanner inputs
*/
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();
}
}
你尝试搜索在Java的电子表格处理库? (提示:在StackOverflow中,这将是脱离主题)。 – RealSkeptic