gpt4 book ai didi

java - 使用数组存储纳税人信息

转载 作者:行者123 更新时间:2023-12-02 06:36:37 24 4
gpt4 key购买 nike

如果我要求“x”税额又如何

最佳答案

do-while 循环之前初始化 childrengrossIncomes 数组。

延长 do-while 循环直到 JOptionPane.showMessageDialog(null,message);

请勿使用numTaxpayers作为childrengrossIncomes的索引。使用 count,并在循环开始之前将 count 初始化为 0。

            int[] children = new int[numTaxpayers];
double[] grossIncomes = new double[numTaxpayers];
int count = 0;
while (count < numTaxpayers)
{
int numChildren = Integer.parseInt(JOptionPane.showInputDialog("How many children do you have?"));
double grossIncome = Double.parseDouble(JOptionPane.showInputDialog("What is your gross income?"));

children[count] = numChildren;
grossIncomes[count] = grossIncome;

count ++;
// Calculations goes here
//....
//...
JOptionPane.showMessageDialog(null,message);
}

关于java - 使用数组存储纳税人信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19575035/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com