error towards the program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<iostream>
using namespace std;
#include <iomanip>
#include <cmath>
class loan{
private:
double rates;
double amount;
double payment;
double totalloan;
double percent;
int years;
public:
double annualInterestRate(double);
int NumberOfYears(int);
double loanAmount(double);
double monthlypayment;
double getannualInterestRate(double);
int getNumberOfYears(int);
double getloanAmount(double);
double setannualInterestRate(double);
double setNumberOfYears(int);
double setloanAmount(double);
double getMonthlyPayment(){
    return ((1 +percent)* amount)/years;}
double getTotalPayment(){
    return totalloan=payment*years;}
};
double loan::setannualInterestRate(double rates){
return rates;
}
double loan::setNumberOfYears(int years){
return years;
}
double loan::setloanAmount(double amount){
return amount;
}
double loan::getannualInterestRate (double percent) {
return percent;
}
int loan::getNumberOfYears(int years){
return years;
}
double loan::getloanAmount(double money){
return money;
}
int main(){
    loan l;
l.setloanAmount(40000);
l.setannualInterestRate(5.5);
l.setNumberOfYears(15);
cout<<" your monthly payment is "<<l.getMonthlyPayment()<<".";
cout<< "Your total payment is"<< l.getTotalPayment()<<endl;
}


error:25:16: warning: 'l.loan::percent' is used uninitialized in this function [-Wuninitialized]
48:10: note: 'l.loan::percent' was declared here
25:25: warning: 'l.loan::amount' is used uninitialized in this function [-Wuninitialized]
48:10: note: 'l.loan::amount' was declared here
25:34: warning: 'l.loan::years' is used uninitialized in this function [-Wuninitialized]
48:10: note: 'l.loan::years' was declared here
27:29: warning: 'l.loan::payment' is used uninitialized in this function [-Wuninitialized]
48:10: note: 'l.loan::payment' was declared here

Thank you very much!!
Last edited on
closed account (1vD3vCM9)
Why have you created a second thread for your problem?
ohoh i thought that if someone answer the question the post will gone
sorry
Topic archived. No new replies allowed.