473,386 Members | 1,819 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,386 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 3224
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.