XYZ Company plans to give a year-end bonus to each of its employee. Write a program which will compute the bonus of an employee. Consider the following conditions: If the employee’s monthly salary is less than PhP 2000, the bonus is 50% of the salary; for employees with salaries at least PhP2000, the bonus is PhP 1500. Print the name and the corresponding bonus for each employee.

PHOTO EMBED

Sun Dec 08 2024 10:19:21 GMT+0000 (Coordinated Universal Time)

Saved by @John_Almer

package yearendbonus;

import java.util.Scanner;
public class YearEndBonus {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
         Scanner input = new Scanner(System.in);

        System.out.print("Enter the employee's name: ");
        String name = input.nextLine();

        System.out.print("Enter the employee's monthly salary: ");
        double salary = input.nextDouble();

        double bonus;
        if (salary < 2000) {
            bonus = salary * 0.5;
        } else {
            bonus = 1500;
        }

        System.out.println(name + "'s bonus is: " + bonus);
    }
}
content_copyCOPY