//A company insures its drivers in the following cases
//1. If the driver is married
//2. If the driver is unmarried, male and above 30 years of age
//3. If the driver is unmarried, female and above 25 years of age
//In all other cases, the driver is not insured.
//If the marital status, sex, age of the driver are the inputs.
//write a program to determine whether the driver is insured or not. (use ‘nested-if’).
import java.util.Scanner;
public class status
{
public static void main(String[] args)
{
char ge,ms;
int age;
System.out.println("Enter marital status(M/N):");
Scanner obj = new Scanner(System.in);
ms = obj.next(). charAt(0);
System.out.println("Enter Gender(M/F):");
ge = obj.next(). charAt(0);
System.out.println("Enter Age:\n");
age= obj.nextInt();
if (ms=='M')
{
System.out.println ("The driver is insured");
}
else if (ge=='M' && age>30 && ms=='N')
{
System.out.println ("Driver is insured");
}
else if (ge=='F' && age>25 && ms=='N')
{
System.out.println ("Driver is insured");
}
else
{
System.out.println ("Driver is not insured");
}
}
}