Sunday, January 23, 2022

question to be implemented


An Insurance company follows following rules to calculate premium.
·        If a person’s health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then the premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhs.
·        If a person satisfies all the above conditions except that the gender is female then the premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakh.
·        If a person’s health is poor and the person is between 25 and 35 years of age and lives in a village and is a male then the premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000.
·        In all other cases the person is not insured.
Write a program to output whether the person should be insured or not, his/her premium rate and maximum amount for which he/she can be insured









 #include <iostream>

using namespace std;
class insurance
{
public:
    char health, sex;
    float age;
    string residence;

    void takeinfo()
    {
        cout << "enter e for excellent health and p for poor health according to your health condition\n";
        cin >> health;
        cout << "enter your age" << endl;
        cin >> age;
        cout << "enter your residence city or village"<<endl;
        cin>>residence;
        cout << "enter your sex M for male or F for female"<<endl;
        cin >> sex;
    }
};
class insurance_eligibility:public insurance{
    public:

insurance_eligibility(){
    takeinfo();
   if (age >=25 && age<=35 &&( health=='e'||health=='E') && residence=="city" && ( sex=='M'||sex=='m'))
   {
       cout<<"your premium is Rs. 4 per thousand and  policy amount cannot exceed Rs. 2 lakhs"<<endl;
   }
   else if (age >=25 && age<=35 && (health=='e'||health=='E') && residence=="city"&&(sex=='F'||sex=='f'))
   {
       cout<<"your premium is Rs. 3 per thousand and  policy amount cannot exceed Rs. 1 lakh"<<endl;
   }
   else if (age >=25 && age<=35 && (health=='p'||health=='P') && residence=="village"&&(sex=='M'||sex=='m'))
   {
       cout<<"your premium is Rs. 6 per thousand and  policy amount cannot exceed Rs. 10000"<<endl;
   }
   else {
       cout<<"either you have entered wrong details and if you have entered right details you are not eligibile to get insured"<<endl;

   }
   
}


};

int main()
{
insurance_eligibility ob;

    return 0;
}

No comments:

Software scope

 In software engineering, the software scope refers to the boundaries and limitations of a software project. It defines what the software wi...

Popular Posts