Android Studio

Employee Salary Calculation in Android Studio

This tutorial will teach you  to calculating the employee salary calculation using Android Studio.android studio projects are easy for developing.This type of android studio projects is so imponent those who want to be good android studio developer. this is the right where you learn android studio projects examples.

Features of the Project

Input the employee name and the 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.

Design the UI Design

Android studio folder structure there is folder which is res this is the folder will help us to make a UI Design of the App.inside res folder you can see the layout folder if you expand the layout folder there is a file
activity_main.xml
in this file we will design App Layout i have design the registration UI design below.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:orientation="vertical"
    android:gravity="center">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:gravity="center"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="30dp"
            android:gravity="center"
            android:text="@string/emptitle"
            android:textSize="25sp"
            android:textStyle="bold"
            android:textColor="@color/colorAccent"
            />

        <ImageView
            android:layout_width="200sp"
            android:layout_height="100sp"
            android:gravity="center"
            android:src="@drawable/payroll"
            />
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20sp"
                android:text="@string/empname"
                android:textColor="@color/colorPrimary"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/empname"
                android:textColor="@color/colorAccent"
                android:gravity="center"

                />

            </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20sp"
                android:text="@string/empsalary"
                android:textColor="@color/colorPrimary"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/empsal"
                android:textColor="@color/colorAccent"
                android:gravity="center"
                />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20sp"
                android:text="@string/emptax"
                android:textColor="@color/colorPrimary"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/emptax"
                android:textColor="@color/colorAccent"
                android:gravity="center"

                />

        </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20sp"
                android:text="@string/netsal"
                android:textColor="@color/colorPrimary"
                />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/netsal"
                android:textColor="@color/colorAccent"
                android:gravity="center"

                />

        </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center">

            <Button
                android:id="@+id/btn1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                android:text="@string/ok" />


            <Button
                android:id="@+id/btn2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                android:text="@string/cancel" />

        </LinearLayout>

        </LinearLayout>
        </LinearLayout>

Inside the Value Folder we have to Make the App Style.

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#008577</color>
    <color name="colorPrimaryDark">#00574B</color>
    <color name="colorAccent">#D81B60</color>
</resources>

strings.xml

admin

Recent Posts

Java Beans

A Java Bean is a reusable software component that follows a specific set of conventions.…

14 hours ago

Java String Methods

Java provides a rich set of built-in methods for handling String operations efficiently. Since strings…

14 hours ago

Java Developer Jobs

Java remains one of the most in-demand programming languages worldwide, powering everything from enterprise applications…

15 hours ago

Converting Integer to String in Java

Java provides multiple ways to convert an integer (int) to a string (String). Whether you're…

15 hours ago

JSP to JSP Communication: A Complete Guide to Dynamic Java Web Development

Java Server Pages (JSP) is a powerful technology used to develop dynamic web applications by…

6 days ago

Which Frontend Framework to Use with Spring Boot?

Spring Boot is a powerful backend framework for developing Java-based web applications. Pairing it with…

7 days ago