KnowledgeBoat Logo

Computer Applications

Mr. Kumar is an LIC agent. He offers discount to his policy holders on the annual premium. However, he also gets commission on the sum assured as per the given tariff.

Sum AssuredDiscountCommission
Up to ₹ 1,00,0005%2%
₹ 1,00,001 and up to ₹ 2,00,0008%3%
₹ 2,00,001 and up to ₹ 5,00,00010%5%
More than ₹ 5,00,00015%7.5%

Write a program to input name of the policy holder, the sum assured and first annual premium. Calculate the discount of the policy holder and the commission of the agent. The program displays all the details as:

Name of the policy holder :
Sum assured :
Premium :
Discount on the first premium :
Commission of the agent :

Java

Java Conditional Stmts

148 Likes

Answer

import java.util.Scanner;

public class KboatLICPolicy
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter Name: ");
        String name = in.nextLine();
        System.out.print("Enter Sum Assured: ");
        double sum = in.nextDouble();
        System.out.print("Enter First Premium: ");
        double pre = in.nextDouble();
        double disc = 0.0, comm = 0.0;

        if(sum <= 100000){
            disc = pre * 5.0 / 100.0;
            comm = sum * 2.0 / 100.0;
        }
        else if(sum <= 200000){
            disc = pre * 8.0 / 100.0;
            comm = sum * 3.0 / 100.0;
        }
        else if(sum <= 500000){
            disc = pre * 10.0 / 100.0;
            comm = sum * 5.0 / 100.0;
        }
        else{
            disc = pre * 15.0 / 100.0;
            comm = sum * 7.5 / 100.0;
        }

        System.out.println("Name of the policy holder: " + name);
        System.out.println("Sum assured: " + sum);
        System.out.println("Premium: " + pre);
        System.out.println("Discount on the first premium: " + disc);
        System.out.println("Commission of the agent: " + comm);

    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of Mr. Kumar is an LIC agent. He offers discount to his policy holders on the annual premium. However, he also gets commission on the sum assured as per the given tariff. Write a program to input name of the policy holder, the sum assured and first annual premium. Calculate the discount of the policy holder and the commission of the agent. The program displays all the details as: Name of the policy holder : Sum assured : Premium : Discount on the first premium : Commission of the agent :

Answered By

70 Likes


Related Questions