logo image

Java program to calculate salary hike

Following program shows you how to calculate salary hike. In this program we get salary per month and hike from user and calculate new salary with hike using following formula Salary hike = oldSalaryPerMonth + (oldSalaryPerMonth X hike/100)

import java.util.Scanner;

public class BasicMath20 {

	public static void main(String[] args) {
		int oldSalaryPerMonth;
		int hike;
		Scanner in = new Scanner(System.in);
		System.out.println("Enter your old salary per month:");
		oldSalaryPerMonth = in.nextInt();
		System.out.println("Enter your hike percentage:");
		hike = in.nextInt();
		int presentSalaryPerMonth = oldSalaryPerMonth + (oldSalaryPerMonth * hike/100);
		System.out.println("After hike your present salary per month is: " + presentSalaryPerMonth );


Enter your old salary per month:
Enter your hike percentage:
After hike your present salary per month is: 55000