Me and my group members are planning to add something different to our program, we intend to put JTextField, but we have no idea on how to start it because some of the tutorials are so hard to understand.
this is our program: it is a payroll system:
public static void main(String[] args) {
// TODO Auto-generated method stub
int od=0;
NumberFormat formatter = new DecimalFormat("#.00");
do{
String name="";
String add= "";
String contact= "";
String email= "";
String want="";
String a= "A";
String b="B";
String c="C";
String d="D";
String e="E";
String f="Q";
int rh=0;
int h=0;
int total=0;
UIManager um=new UIManager();
um.put("OptionPane.background",Color.black);
um.put("Panel.background",Color.magenta);
JOptionPane.showMessageDialog(null," Welcome"+" \n To Payroll System!!!");
um.put("OptionPane.background",Color.black);
um.put("Panel.background",Color.pink);
name=JOptionPane.showInputDialog(null, "Enter Name:","Name",JOptionPane.PLAIN_MESSAGE);
um.put("OptionPane.background",Color.black);
um.put("Panel.background",Color.pink);
add= JOptionPane.showInputDialog("Enter Address:");
um.put("OptionPane.background",Color.black);
um.put("Panel.background",Color.pink);
contact= JOptionPane.showInputDialog("Enter contact:");
um.put("OptionPane.background",Color.black);
um.put("Panel.background",Color.pink);
email= JOptionPane.showInputDialog("Enter Email Address:");
um.put("OptionPane.background",Color.black);
um.put("Panel.background",Color.pink);
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);
um.put("OptionPane.background",Color.black);
um.put("Panel.background",Color.pink);
want=JOptionPane.showInputDialog("How do you want to calculate your rate? \n\nA. Per Hour? \n\nB.Per day? \n\nC.Per week? \n\nD.Per Month? ");
if (want.equalsIgnoreCase("A")){
h=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of hours:"));
total= rh*h;
JOptionPane.showMessageDialog(null, "Your Total Rate Per Hour is: "+formatter.format(total)+" PHP");
}
else if(want.equalsIgnoreCase("B")){
int day=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Days:"));
int dd = 0;
total= rh*dd;
JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is: "+formatter.format(total)+" PHP");
}
else if(want.equalsIgnoreCase("C")){
int week=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of Weeks:"));
int dd = 56*week;
total= rh*dd;
JOptionPane.showMessageDialog(null, "Your Total Rate Per Week is: "+formatter.format(total)+" PHP");
}
else if(want.equalsIgnoreCase("D")){
int month=Integer.parseInt(JOptionPane.showInputDialog("Enter Number of MOnth:"));
int dd = 224*month;
total= rh*dd;
JOptionPane.showMessageDialog(null, "Your Total Rate Per Day is: "+formatter.format(total));
}
od=JOptionPane.showConfirmDialog(null, "Do you want another transaction?","Another transaction",JOptionPane.YES_NO_OPTION);
}while (od==0) ;
}
}
please correct something if there is an error thank you :)