Computer Science, asked by pras38, 11 months ago

Write a program in JAVA to input name and basic salary of an employee. Calculate and display the gross salary and net salary when:

da=30% of basic

hra=12.5% of basic

pf=10% of basic

gross=basic+da+hra

net pay=gross-pf

Answers

Answered by Ranauk456
37

import java.util.*;

Class employee

{

public static void main (string args[])

{

Scanner sc = new Scanner ( System.in);

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

string nm = in.next();

System.out.println ("Enter the basic salary")

int sal = in.nextInt();

{

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

da = 0.30*sal;

hra=12.5*sal;

pf=0.10*sal;

gp = sal+ da+hra;

np = gp - pf;

}

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

System.out.println("Basic salary : "+sal);

System.out.println("Gross salary :"+ gp);

System.out.println(" Net salary "+np);

}}

Answered by Annesha892
8

import java.util.*;

Class employee

{

public static void main (string args[])

{

Scanner sc = new Scanner ( System.in);

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

string nm = in.next();

System.out.println ("Enter the basic salary")

int sal = in.nextInt();

{

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

da = 0.30*sal;

hra=12.5*sal;

pf=0.10*sal;

gp = sal+ da+hra;

np = gp - pf;

}

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

System.out.println("Basic salary : "+sal);

System.out.println("Gross salary :"+ gp);

System.out.println(" Net salary "+np);

}}

Attachments:

Annesha892: bro's answer
pras38: okay
Annesha892: hmm. goodnight bros
Annesha892: take care
pras38: yeah goodnight and all the best for your exam
Ranauk456: yeah, give the exam quitely goodnight
Annesha892: thanks
Annesha892: bye takecare
Ranauk456: bye may god help you
pras38: bye may god bless you and always stay with you
Similar questions