Java 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 (5 marks) 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
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
System.out.println("Enter age: ");
int age=in.nextInt();
System.out.println("Enter weight: ");
int weight=in.nextInt();
System.out.println("Enter height: ");
int height=in.nextInt();
if(age>45 && height>4 && weight>70){
System.out.println("\nHigh payment of life insurance premium");
}
else{
System.out.println("\nLow payment of life insurance premium");
}
}
}
Comments
Leave a comment