help how to make payroll using java program and the following conditions:

1.one dimensional array
2.two dimensional array
3. accept inputs of string, integer and double data types
4. validation using if-else-if
5. use of loops constructs
6. computation
7. summary
8. use of JOptionpane/system.out.print

pleas help me

Recommended Answers

All 10 Replies

Okay? And your question about it would be?

Okay? And your question about it would be?

pleas help me

Well, the description is fairly clear, so you don't need any help with that, so you must be having some sort of problem with your code, well, post the problem code here along with the compiler and/or exception messages and we will help you.

but i don't know how to start
i`am not a professional programmer i`am only a student and i only know
the basic part of the java
pleas help me

Which is enough to at least get started. You wouldn't have this assignment for your homework if the class weren't far enough along to at least get most of it correct (with a little space for self-initiative), so do at least that much of it, as well as you can. No one here is going to do your homework for you.

you're not a student, you're just a lazy schoolkid.
If you'd paid attention in class and done your homework until now you'd have no problem doing this yourself.
So if you can't do it, you only have yourself to blame and deserve no help from us or anyone else.

import java.swing JOptionPane;
{

public class Payroll

{


public static void main( String args[] )

{

System.out.println( "Welcome to the Payroll Program!" );

boolean stop = false;

while (!stop);

{


Scanner input = new Scanner(System.in );

System.out.println();

System.out.print( "Enter Employee's Name or stop to exit program: " );

String empName = input.nextLine();

if ( empName.equals("stop"))

{

System.out.println( "Program Exited" );

stop = true;

}

else

{

float hourlyRate;

float hoursWorked;

float weeklyPay;

System.out.print( "Enter hourly rate: " );

hourlyRate = input.nextFloat();

while (hourlyRate <= 0) // prompt until pos. value is entered

{

System.out.print( "Hourly rate must be a positive number. " + "Please enter the hourly rate again: " );

hourlyRate = input.nextFloat(); // read hourly rate again

}

}

System.out.print( "Enter hours worked: " );

hoursWorked = input.nextFloat();


while (hoursWorked <= 0)

{

System.out.print( "Hours worked must be a positive number. " + "Please re-enter hours worked: " );


hoursWorked = input.nextFloat();

}

weeklyPay = (float) hourlyRate * hoursWorked;

System.out.print( empName );

System.out.printf( "'s weekly pay is: $%,.2f\n", weeklyPay);


System.out.println( "Closing Payroll Program." );

}

}

this is my program but i dont know how can i put a code to have
a one dimensional array and two dimentional aaray ang the summary
and even the computation

This looks more like your "last" assignment, upon which thisd assignment is to build, and since you confess to not knowing anything about it, I can only assume that you got this from someone else as well, and you still don't know why it's not a good idea to have someone else do your homework? It's because you don't learn anything, making the next assignment all that much harder, and, eventually, our work harder, since, eventually, we may have to work with you.

Start by planning what you are going to do.

Write the class, and think about the numerous methods that the payroll class might have. Furthermore, there are so many number of ways to do such a payroll system.

But without proper requirements to write the program, you sure are going to get widely different answers.

the Payroll system apparently must be used not only for one employee but for many, hence arrays are supposed to be used.

My java is a bit rusty, but you should maybe create an employee class, and the calculations of payroll as methods. In this case, it would be easy to 'polyphormise' the payroll method to cater for any type of employee, inherited class managers with different payroll methods.

Hope you are understanding something from this.

Multidimensional array might be used to store not only the employee info, but also the payroll amount you'll eventually calculate. ( Or so I think).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.