Computer Science, asked by justdoit52, 9 months ago

Write a program to input the name and Basic salary of an employee. Calculate the HRA as 20% of Basic salary, DA as 100% of Basic salary, PF as 13% of Basic salary, Gross pay = Basic salary + HRA + DA, Netpay = Gross pay-PF( need answer before 9:02 )

Answers

Answered by iamemma112358
2

import java.util.*;

class employee

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

double hra=0.0, da=0.0, pf=0.0, gp=0.0, np=0.0;

System.out.println("Enter the name of the employee:");

String str=sc.nextLine();

System.out.println("Enter the basic salary of the employee:");

double bs=sc.nextDouble();

hra=0.2*bs;

da=1*bs;

pf=0.13*bs;

gp=bs+hra+da;

np=gp-pf;

System.out.println("Name of the employee:" + str);

System.out.println("Netpay:"+np);

}

}

Answered by AmritanshuKesharwani
0

Answer:

#include<stdio.h>

#include<string.h>

int main()

{

int i;

char z[10];

printf("Enter your first name\n");

scanf("%s",&z[i]);

int a;

int b;

int c;

int d;

int e;

int f;

printf ("Enter your Basic Pay:");

scanf ("%d", &a);

b=a*20/100;

printf ("\nYour HRA is:%d",b);

c=a;

printf ("\nYour DA is %d:",c);

d=a*13/100;

printf ("\nYour PF is:%d",d);

e=a+b+c;

printf ("\nYour gross pay is:%d",e);

f=e-d;

printf ("\nYour net pay is:%d",f);

}

Explanation:

Here, I am using C programming language to solve this algorithm. Here, I am using two libraries called as the first library is #include<stdio.h> and the second library which I write in this algorithm is #include<string.h> which is very useful in taking the input from user in the form of string. Here, I have to take the name as a input so we use this library called #include<string.h>. It is a header file of C programming language.

I am using Linux environment for solving algorithms and writing codes. So, sometimes with output, there is a sign of dollar comes. So, I am really sorry for this. But you can understand the output. #include<stdio.h> refers to the standard input output. It is also a header file and library of C programming language which contain these functions are printf() function and scanf() function. Here, I am using new line to print any data in next line.

Learn more from this link:

https://brainly.in/question/12971913

#Be Brainly

Attachments:
Similar questions