package PAyroll;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import java.awt.Color;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import javax.swing.UIManager;
public class EmployeeProfile {
public static void main(String[] args){
JOptionPane.showMessageDialog(null,"Welcome to Payroll System");
payroll();
}
public static void payroll(){
int conf=0;
// do{
String name="";
String add= "";
String contact= "";
String email= "";
String word="";
String mainmenu="";
int rh=0;
int employee=0;
int r=0;
mainmenu=JOptionPane.showInputDialog(null,"A. Employee \nB. Compute Payroll \nC. Display Payslip \nE.Exit ");
int size[]= new int[employee];
employee =Integer.parseInt(JOptionPane.showInputDialog(null,"Enter number of employees: "));
for(int x=0;x<=size.length;x++){
name = JOptionPane.showInputDialog(null, "Enter Name:","Employee ["+(x+1)+"];",JOptionPane.PLAIN_MESSAGE);
add = JOptionPane.showInputDialog(null,"Enter Home Address:","Employee ["+(x+1)+"];",JOptionPane.PLAIN_MESSAGE);
contact = JOptionPane.showInputDialog(null,"Enter contact:","Employee ["+(x+1)+"];",JOptionPane.PLAIN_MESSAGE);
email = JOptionPane.showInputDialog(null,"Enter Email Address:","Employee ["+(x+1)+"];",JOptionPane.PLAIN_MESSAGE);
if ( name == null || name.equals("") || add == null || add.equals("") || contact == null || contact.equals("") ||
email ==null || email.equals("")){
JOptionPane.showMessageDialog(null,"invalid information","Student Enrollment",JOptionPane.PLAIN_MESSAGE);
}
rh = Integer.parseInt(JOptionPane.showInputDialog("Enter Rate Per Hour:"));
JOptionPane.showMessageDialog(null,"Name: "+name+"\n\nHome Address:"+add+"\n\nContact:"+contact+"\n\nEmail Address:"+email);
}
}
}
in this code, if the user inputs 2 employees, the whole code must be repeated twice.
thanks
waiting for ur reply guys!