Java 使用if条件内文件中的数据

Java 使用if条件内文件中的数据,java,Java,我目前正在为我的学校项目进行工资单项目,我有以下代码: ` PrintWriter taxes=new PrintWriter(new FileWriter(“Tax.txt”,true)); System.out.println(“您正在更新累进税”); System.out.println(“输入括号总数:”); int amount=scan.nextInt()-1; 对于(int i=0;i而言,维护此类数据(插入和获取)将很困难,使用文本文件。有效的方法是使用excel工作表,其中每个

我目前正在为我的学校项目进行工资单项目,我有以下代码: `

PrintWriter taxes=new PrintWriter(new FileWriter(“Tax.txt”,true));
System.out.println(“您正在更新累进税”);
System.out.println(“输入括号总数:”);
int amount=scan.nextInt()-1;

对于(int i=0;i而言,维护此类数据(插入和获取)将很困难,使用
文本
文件。有效的方法是使用
excel工作表
,其中每个
将为单个迭代处理不同的记录。您可以使用
Apache POI库
移动,该库易于读取和写入。我在google上有一个示例

确定,但如何将值放入相应的pl中aces?在理解excel中的ProcessResponsed place mean列时仍有困难?我在答案中提供了一个链接。请遵循此链接,如果您面对任何pblm,请让我知道
PrintWriter taxes = new PrintWriter(new FileWriter("Tax.txt", true));
     System.out.println("You are updating Progressive Tax");
     System.out.println("Enter the number of total brackets:");
     int ammount = scan.nextInt()-1;
     for(int i=0; i<= ammount -1; i++){
         System.out.println("Enter the bracket top limit:");
         double bracket = scan.nextDouble();
         System.out.println("Enter the tax for the bracket:");
         double tax = scan.nextDouble()/100;
         taxes.println("Up to: " + String.format("%.2f", bracket));
         taxes.println("Tax percentage: " + String.format("%.2f", tax));
         if(i == ammount -1){
             System.out.println("Enter the bracket bottom limit:");
             bracket = scan.nextDouble();
             System.out.println("Enter the tax for the bracket:");
             tax = scan.nextDouble()/100;
             taxes.println("From: " + String.format("%.2f", bracket));
             taxes.println("Tax percentage: " + String.format("%.2f", tax));
        }
    }`
 `if (baseSalary <= (to be read from file){
         insurance = (to be read from file)*baseSalary;
         social = (to be read from file)*baseSalary;
         tax = (to be read from file)*baseSalary;
    }`