Java

Employee Salary Calculation using Java

Input the employee name and basic salary calculate and display the netsalary using following condition

if the basic salary is more than 50000 then include 10% Tax

if the basic salary is more than 30000 then include 5% Tax

otherwise no Tax.

public class JavaEx {

    public static void main(String args[])
    {
        String name ="Peter";
        double basicsalary = 60000.00;
        double tax,nsal;

        if (basicsalary > 50000)
        {
            tax = basicsalary * 10/100;

        }
        else if(basicsalary > 30000)
        {
            tax = basicsalary * 5/100;
        }
        else
        {
            tax = 0;
        }

        System.out.println(tax);
        nsal = basicsalary - tax;
        System.out.println(nsal);
    }

}

 

 

 

 

admin

Recent Posts

Build Simple Water System Calculator in Java Using Swing

If you're just beginning to learn Java GUI programming creating an Water System Calculator is a fantastic project for…

16 hours ago

GitHub Copilot vs Microsoft Copilot Best AI Tool to Use in 2025

GitHub is a powerful tool used by teams and developers around the globe. This guide is…

5 days ago

Chat with Claude AI Free – Your Super-Smart AI Buddy

It's like having a super-smart buddy that is always there to help you write stories,…

1 week ago

Best Festivals UK 2025 [Free Guide Included]

The UK is known for its rich history, diverse culture, and most of all  its…

2 weeks ago

Bank Holidays 2025 UK – Plan Your Perfect Long Weekends

Do you have a plan for your next holiday? Being aware of the Bank Holidays within the…

2 weeks ago

Master Cursor AI Full Guide for Students & Creators

The world is rapidly changing of software development AI-assisted tools for coding have become the main focus. As…

2 weeks ago