public class employee {
String empname;
int empcode ;
double basicpay;
employee()
{
empname = "";
empcode = 0;
basicpay = 0.0;
}
employee(String n , int p , double q)
{
n = empname;
p = empcode;
q = basicpay;
}
double salarycal()
{
double salary,hra,da,allowance,totalsalary;allowance = 0;totalsalary = 0;
hra = 0.3*basicpay;
da = 0.4*basicpay;
salary = basicpay + hra + da;
if(empcode<=15 && salary<=15000)
{
allowance = 0.2*salary;
if (allowance> 2500)
allowance = allowance - (allowance-2500);
}
else
{
allowance = 1000;
}
totalsalary =salary + allowance;
return totalsalary;//the problem is that the total salary is not returned.
}
}
請告訴該程序必須進行哪些更正。返回值顯示爲0.0。爲什麼這樣?
緊急或儘快解決的事實與主要問題完全無關。如果你需要快速的話,那麼去一個你**支付**解決方案的網站。在這裏你會得到免費的幫助 –
你甚至可以調試你的應用程序來看看發生了什麼? –