here it is(I am still using IF only in my coding,because I am a beginner in C++)
Code: Select all
//My testing program in loan system
#include<iostream>
using namespace std;
int main()
{
int loan,amount,time,premium,intrest;
cout<<"Welcome to loan system made by G-sparkZ"<<endl<<endl;
cout<<"loan code numbers"<<endl<<endl;
cout<<"Housing loan = 1"<<endl;
cout<<"govenment loan = 2"<<endl;
cout<<"forces loan = 3"<<endl<<endl;
cout<<"Please enter your loan code - "<<endl;
cin>>loan;
if(loan==1)
{cout<<endl<<"Normal Housing loan calculation Begings"<<endl<<endl;
cout<<"Enter your loan amount - ";
cin>>amount;
cout<<endl<<"Enter your loan paying duration (years) - ";
cin>>time;
intrest=amount*14/100;
time=time*12;
premium=(amount+intrest)/time;
cout<<endl<<"your Premium is "<<premium<<" per month "<<endl;
}
else if(loan==2)
{cout<<endl<<"Govenment Housing loan calculation begins"<<endl<<endl;
cout<<"For govenment workers only"<<endl;
cout<<"Enter your loan amount - ";
cin>>amount;
cout<<endl<<"Enter your loan paying duration (years) - ";
cin>>time;
intrest=amount*9/100;
time=time*12;
premium=(amount+intrest)/time;
cout<<endl<<"your Premium is "<<premium<<" per month "<<endl;
}
else if(loan==3)
{cout<<"Speacial Forces loan calculation begins"<<endl<<endl;
cout<<"For Aramy,Air force,Navy,Police"<<endl;
cout<<"Enter your loan amount - ";
cin>>amount;
cout<<endl<<"Enter your loan paying duration (years) - ";
cin>>time;
intrest=amount*7/100;
time=time*12;
premium=(amount+intrest)/time;
cout<<endl<<"your Premium is "<<premium<<" per month "<<endl;
}
else
{cout<<"wrong code entered please try again"<<endl<<endl;
system("pause");
return 1;
}
system("pause");
return 1;
}
1.I wanna add some values that user can Input.
Ex-Normal housing loan
amount 100 000 & 200 000 only,Time 1 or 2 years.
government housing loan
amount 100 000 , 200 000 , 300 000 only,Time 1 - 3 years.
forces loan
amount 100 000 , 200 000 , 250 000 only,Time 1 - 3 years.
2.If user input wrong amount or time I wanna ask my question again "enter your loan amount" or "Enter your loan paying duration" again.