0% found this document useful (0 votes)
12 views

Untitled Document

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Untitled Document

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

‭Salary Calculator‬

‭Aim:‬

‭ he aim of this Java program is to calculate the total salary of an employee based on their basic‬
T
‭salary, including allowances such as HRA, DA, and TA.‬

‭Program :‬

‭import java.util.Scanner;‬

‭public class CalculateTotalSalary {‬


‭public static void main(String[] args) {‬
‭Scanner scanner = new Scanner(System.in);‬
‭System.out.print("Enter basic salary: ");‬
‭double basic = scanner.nextDouble();‬
‭double hra = basic*0.3;‬
‭double da = basic*0.5;‬
‭double ta = 1800.00;‬
‭double totalSalary = basic+hra+da;‬
‭System.out.println("Total salary: " + totalSalary);‬
‭scanner.close();‬
‭}‬
‭}‬

‭Output‬‭:‬

‭ onclusion‬‭:‬
C
‭The program assumes fixed percentages for HRA and DA and a fixed amount for TA, which are‬
‭common scenarios in salary calculations. It provides a straightforward example of how to‬
‭perform basic arithmetic operations and handle user input in Java.‬

You might also like