473,287 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

program to calculate gross salary

import java.util.*;
class emp
{
int eno;
String ename;
int ddob, mdob, ydob, ddoj, mdoj, ydoj, yoe, cyear;
double basic, hra, trans, medi, cbonus, ded, gsal;
double cbonus( int yoe)
{
if(yoe>=10)
cbonus=basic*0.10;
else if(yoe>=5 && yoe<=9)
cbonus=basic*0.07;
else if(yoe>=2 && yoe<=4)
cbonus=basic*0.05;
else
cbonus=basic*0.03;
return(cbonus);
}

double ded( double basic)
{
if(basic>=500)
ded=basic*0.10;
if(basic>=300 && basic<500)
ded=basic*0.06;
else
ded=basic*0.03;
return (ded);
}

int yoe(int ydoj)
{
yoe=cyear-ydoj;
return(yoe);
}

double gsal()
{
gsal=basic+hra+ trans+medi+cbonus-ded;
return(gsal);
}

public class prgrmnew
{
static Scanner console=new Scanner(System.in);
public static void main(String args[])
{

double[] a = new double[5];



}
}
}
May 27 '16 #1
5 3215
johny10151981
1,059 1GB
I can see a source code dump. What's the problem?
May 27 '16 #2
i am not able to declare an array and proceed as it shows errors. Pardon me for the codes as I'm still working on it.
May 27 '16 #3
johny10151981
1,059 1GB
What line? What does the error says?
May 27 '16 #4
the line that includes the static scanner and the next line.
it says inner classes cannot contain static declarations.
May 27 '16 #5
chaarmann
785 Expert 512MB
You made your class "prgrmnew" an inner class, but method main() should be in an "outside" class. Then you can define your static scanner.
To change your code just move the last closing curly bracket BEFORE this class "prgrmnew".

Hint: Use code tags surrounding your listing, so I can answer better by referring to a line number
And please use meaningful names! "prgrmnew" is in no way acceptable. Use camelCase and no abbreviations. Classes start with capital letter. So "NewProgram" would be a correcly named class name, although not meaningful. Just say what it is! I just guess "EmployeeBonusCalculator".
May 30 '16 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: nisha | last post by:
A#include<fstream.h> #include<conio.h> #include<stdio.h> #include<ctype.h>A #include<graphics.h> #include<process.h> fstream dat,dat1; float gsal,pf; char flname={"dsb"}; class emptax
5
by: james121285 | last post by:
This is to calculate an employees tax and pension. The salary is input from the keyboard. The NI contribution is calculated as 6% of the gross salary. The pension contribution is calculated as 2%...
0
by: AZRebelCowgirl73 | last post by:
I have designed a program according to the specifications required except for two things! I need to somehow set a 70 hour limit to the HE employees hours worked, and the weeks should be no less than...
8
by: mulugeta01 | last post by:
guys I have just started to learn c programing and i have some small assign ment to do . i cant go through , Please help, That is to calulate net salary after tax.1.gross salay = 78000 2.social...
7
by: habsy | last post by:
The below are the question given; Please help. (Payroll) Write a program that reads the following information and prints payroll statements in show message dialog box. These are the...
1
by: rudyj | last post by:
i have trid different programs and nothing works for this
1
by: Anjaly R Nair | last post by:
employee should pay income tax if monthly gross salary is more than Rs10000 and percentage of income tax consider as 20% of gross salary. display employee id , basic salary, allowances, gross pay,...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.