Ramesh's basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
Overall, this program is a basic example of how Java can be used to perform simple mathematical operations and input/output operations.
import java.util.Scanner; class Gross_Salary { public static void main(String arga[]) { float bs,da,rh; Scanner input = new Scanner(System.in); System.out.println("Enter the Basic Salary :"); bs = input.nextFloat(); da = bs*0.4f; rh = bs*0.2f; System.out.println("Total Gross Salary : "+(bs+da+rh)); } }
Enter the Basic Salary : 15000 Total Gross Salary : 24000.0
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions