Question #228303

a. C++ is known to be an object-oriented program. Objects are also known
to exist in real life. You have been invited as a computer science student
to distinguish between real life objects and object found in object oriented
program OOP.

b. Write an OOP to compare the risk factor that will lead to high payment of
life insurance premium. The variables to consider are: age, weight, and
height
1. The program should request for the variables to be inputted from the
keyboard.

2. Premium should be high if age is greater than or equal to 60 years and
weight is greater than or equal 80kg and has greater than or equal 6.8 feet. Otherwise the premium should be low.

3. Critically explain how the program could be adopted by allied companies for their operations.

Expert's answer

// a. Real life object is something that can be grabbed and has properties while object found in object oriented


// program OOP are instances of a class.


// b. 
#include <iostream>


using namespace std;


int main()
{
    int age;
    double height,weight;
    cout<<"\nEnter age: ";
    cin>>age;
    cout<<"\nEnter weight: ";
    cin>>weight;
    cout<<"\nEnter height: ";
    cin>>height;
    if (age>=60 && weight>=80 && height>=6.8)
        cout<<"\nPremium is high";
    else
        cout<<"\nPremium is low";


    return 0;
}

LATEST TUTORIALS
APPROVED BY CLIENTS