我需要計算貸款金額(P),期限(年)以及年百分比率的分期貸款的月付款(M)。 M =(P * i *(1 + i)n)/((1 + i)n-1)其中i =年百分比率/ 1200和n =期間* 12。視覺工作室的網絡服務。我似乎無法在Web服務中使用Math.Pow。這是我在代碼中的方法:網絡服務數學
這是我的錯誤消息:錯誤1'ProjectFive.payment.Math(double,double,double,double)'是'方法',在給定的上下文中無效C:\用戶\ parodeghero \文檔\ Visual Studio 2010的\項目\ ProjectFive \ ProjectFive \ payment.asmx.cs 27 38 ProjectFive
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace ProjectFive
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class payment : System.Web.Services.WebService
{
[System.Web.Services.WebMethod()]
public double Math(double loan, double rate, double period, double payment)
{
rate = rate/100;
period = period * 12;
payment = loan*(rate/1200)*Math.Pow((1+(rate/1200)), period)/ Math.Pow((1 + (rate/1200)), period) - 1;
return payment;
}
}
}
什麼「我似乎無法使用」究竟意味着什麼?你得到編譯器錯誤還是什麼? – 2012-03-26 01:25:39
分母不應該是'Math.Pow((1 +(rate/1200)),period - 1)'? – 2012-03-26 01:28:45
公共雙數學(雙倍貸款,雙倍利率,雙倍期間,雙重付款) { 是的,它說這個代碼上面是無效的 – asguy 2012-03-26 01:29:25