Computer Science, asked by agarwalpriyansh362, 8 months ago

Write a java program to do the following:-company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. Ask user for their salary and year of service and print the net bonus amount.

Answers

Answered by manuprajapati519
24

import java.util.Scanner;

public class bonus

{

public static void main(String args[])

{

double c;

Scanner in = new Scanner(System.in);

double a; double b;

System.out.println("Input the monthly salary");

a=in.nextInt();

System.out.println("Give your serving years");

b=in.nextInt();

c=(5/100)*a;

if (b>5||b==5)

{

System.out.println("Here's your bonus:]" +c);

}

else

{

System.out.println("Your bonus access is denied");

}

}

}

Hello I also wanted to ask wether the bonus is getting on the salary or I have to add the bonus in salary?

But Still I made the program in thinking of 1st condition.

In 2nd condition You only get 0.05 rupees so I don't think you needed this conditon.

BTW

Please rate my Answer also if you got any help from this, THANK YOU:)

Answered by Anonymous
7

Answer:

import java.util.Scanner;

public class bonus

{

public static void main(String args[])

{

double c;

Scanner in = new Scanner(System.in);

double a; double b;

System.out.println("Input the monthly salary");

a=in.nextInt();

System.out.println("Give your serving years");

b=in.nextInt();

c=(5/100)*a;

if (b>5||b==5)

{

System.out.println("Here's your bonus:]" +c);

}

else

{

System.out.println("Your bonus access is denied");

}

}

}

Hello I also wanted to ask wether the bonus is getting on the salary or I have to add the bonus in salary?

But Still I made the program in thinking of 1st condition.

In 2nd condition You only get 0.05 rupees so I don't think you needed this conditon.

BTW

Please rate my Answer also if you got any help from this, THANK YOU:)

Similar questions