Question: Please help, I am having an issue with combining 2 programs. Java Code hardcode username with hourly pay coding. The required login and password information
Please help, I am having an issue with combining 2 programs.
Java Code hardcode username with hourly pay coding. The required login and password information must be created as part of an array and include the following information so that your instructor may access the program. Login: Admin Password: Password1
Alter the code to include a Login and Password window that checks the entries against the list of user IDs and Passwords in the database. The array should contain 10 records.

Program 2nd part: And the code must include the program for payroll. I am having an issue combining the two.
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JTextField; public class PayRollCalc extends JFrame implements ActionListener { JLabel lb1,lb2,lb3,lb4; JTextField tf1,tf2,tf3; JButton b1; JTextArea textArea; public PayRollCalc() { this.setTitle("PayRoll Calculator "); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(null); this.setBounds(0,0,380,400); this.setVisible(true); lb1=new JLabel("Name : "); lb1.setBounds(10,10,100,30); this.add(lb1); tf1=new JTextField(); tf1.setBounds(110, 10, 100, 30); this.add(tf1); lb2=new JLabel("Hours Worked : "); lb2.setBounds(10,50,100,30); this.add(lb2); tf2=new JTextField(); tf2.setBounds(110, 50, 100, 30); this.add(tf2); lb3=new JLabel("Pay Rate : "); lb3.setBounds(10,90,100,30); this.add(lb3); tf3=new JTextField(); tf3.setBounds(110, 90, 100, 30); this.add(tf3); b1=new JButton("Calculate"); b1.setBounds(110,150,100,30); this.add(b1); b1.addActionListener(this); textArea = new JTextArea(""); textArea.setBounds(20, 220, 300, 140); textArea.setEditable(false); this.add(textArea); repaint(); } public static void main(String[] args) { new PayRollCalc(); } @Override public void actionPerformed(ActionEvent e) { String name=tf1.getText(); double hours=Double.parseDouble(tf2.getText()); double PayRate=Double.parseDouble(tf3.getText()); double gross,net,fedTax,Medicare,FICA; if(hours>60){ System.out.println("Invalid"); textArea.setText("Invalid Hours Hours must be less than 60 per Week"); }else{ if(hours>40){ gross=hours*PayRate+(hours-40)*PayRate*0.5; }else{ gross=hours*PayRate; } fedTax=gross*6.2/100; Medicare=gross*1.45/100; net=gross-fedTax-Medicare; String res="Name : "+name+" Hours Worked : "+hours+" Pay Rate : "+PayRate+" Gross : "+gross+" Federal Tax (6.2 %) : "+fedTax+" Medicare(1.45%):"+Medicare+" Net Pay : "+net; textArea.setText(res); } } }
USERID PASSWORD ID O Admin Password 1 1 Vale.Vicky ZZZZZZZ N Lane. Lois WWWW N Kent.Clark AAAAAA 3 Wayne.Bruce FFFFFFFF 4 Parker. Peter RRRRRRR 5 Rogers.Steve QQQQQQ 6 Luther.Lex GGGGGG 7 Osborn. Harry YYYYYY 8 Prince.Diana LLLLLLL 9 Linda Zoel PPPPPPPP
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
