2017-04-07 80 views
0

我堅持貸款攤銷清單,它只給我最後一個項目多次。我的方法:貸款攤銷只返回最後一個項目java

public List<AmortizationScheduleLineItem> calculateAmortizationSchedule() { 
     List<AmortizationScheduleLineItem> lineItems = new ArrayList<AmortizationScheduleLineItem>(); 

     AmortizationScheduleLineItem item = new AmortizationScheduleLineItem(); 

     long balance = amountBorrowed; 
     int paymentNumber = 0; 
     long totalPayments = 0; 
     long totalInterestPaid = 0; 

     item.setPaymentNumber(paymentNumber++); 
     item.setPaymentAmount(0d); 
     item.setPaymentInterest(0d); 
     item.setCurrentBalance(((double) amountBorrowed)/100d); 
     item.setTotalPayments(((double) totalPayments)/100d); 
     item.setTotalInterestPaid(((double) totalInterestPaid)/100d); 
     lineItems.add(item); 
     final int maxNumberOfPayments = initialTermMonths + 1; 
     while ((balance > 0) && (paymentNumber <= maxNumberOfPayments)) { 
      long curMonthlyInterest = Math.round(((double) balance) * monthlyInterest); 
      long curPayoffAmount = balance + curMonthlyInterest; 
      long curMonthlyPaymentAmount = Math.min(monthlyPaymentAmount, curPayoffAmount); 
      if ((paymentNumber == maxNumberOfPayments) 
        && ((curMonthlyPaymentAmount == 0) || (curMonthlyPaymentAmount == curMonthlyInterest))) { 
       curMonthlyPaymentAmount = curPayoffAmount; 
      } 

      long curMonthlyPrincipalPaid = curMonthlyPaymentAmount - curMonthlyInterest; 

      long curBalance = balance - curMonthlyPrincipalPaid; 

      totalPayments += curMonthlyPaymentAmount; 
      totalInterestPaid += curMonthlyInterest; 

      item.setPaymentNumber(paymentNumber++); 
      item.setPaymentAmount(((double) curMonthlyPaymentAmount)/100d); 
      item.setPaymentInterest(((double) curMonthlyInterest)/100d); 
      item.setCurrentBalance(((double) curBalance)/100d); 
      item.setTotalPayments(((double) totalPayments)/100d); 
      item.setTotalInterestPaid(((double) totalInterestPaid)/100d); 
      lineItems.add(item); 
      // Set P equal to Q and go back to Step 1: You thusly loop around until the value Q (and hence P) goes to zero. 
      balance = curBalance; 

     } 

     return lineItems; 
    } 

我的Web服務方法:

@WebResult(name = "PaymentPlan") 
    @WebMethod(operationName = "GetLoanPaymentPlan") 
    public List<AmortizationScheduleLineItem> GetLoanPaymentPlan() { 
     AmortizationScheduleInput input = new AmortizationScheduleConsoleInputOutput().readUserInputFromConsole(); 
     LoanAmortizationSchedule loan = new LoanAmortizationSchedule(input); 
     return loan.calculateAmortizationSchedule(); 
    } 

我的迴應:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
     <ns2:GetLoanPaymentPlanResponse xmlns:ns2="http://service.dfcu.com/"> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     <PaymentPlan> 
      <currentBalance>0.0</currentBalance> 
      <paymentAmount>0.05</paymentAmount> 
      <paymentInterest>0.0</paymentInterest> 
      <paymentNumber>61</paymentNumber> 
      <totalInterestPaid>396095.05</totalInterestPaid> 
      <totalPayments>1396095.05</totalPayments> 
     </PaymentPlan> 
     </ns2:GetLoanPaymentPlanResponse> 
    </S:Body> 
</S:Envelope> 

我該怎麼辦,以獲取列表中的其他項目?

回答

1

您需要

while (....) 
{ 
    AmortizationScheduleLineItem item = new AmortizationScheduleLineItem(); 
    ... 
    listItems.add (item); 
} 

否則你在同一對象上所有的時間

+0

哇,好謝謝你的工作循環的每個迭代創建一個新的項目對象。這工作。 – ErrorNotFoundException

+0

不用客氣 –

+0

btw重複;) –