I would like this assignment to be done using Java, and I wanted it to work on m
ID: 3576380 • Letter: I
Question
I would like this assignment to be done using Java, and I wanted it to work on mobile phones if possible Create a database that will store the information ID/PIN/Start shift Break out/Break in/End Shift/include the report information Thank you very much This is a login system for time clock, I want the user to enter their ID and PIN numbers by clicking on the buttons or by using the keyboard or touch screen for mobile They will have to create a PIN number, the user will have his ID provided Then they will login by using the ID and the PIN number The Clear button: will clear the entries the Submit will take the user to a new window. This new window will have an application to calculate the number of hours and minutes worked per day, per week and per two weeks When the user clicks on start shift button the time will start counting When the user clicks on Break out the timer will stop When the user clicks on break in the timer will start counting the number of hours, minutes At the end of the shift, when the user clicks on end shift the calculator will stop for that day, and take the cumulus for the next day.Explanation / Answer
package loginsystem;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.Timer;
public class Loginsystem implements ActionListener {
JFrame f;
JTextField t1,t2;
JLabel l1,l2;
JButton bsub,bclr;
String a,b;
static int operator=0;
Loginsystem()
{
f=new JFrame("Login System");
t1=new JTextField();
t2=new JTextField();
l1=new JLabel("Enter your id#");
l2=new JLabel("Enter your PIN");
bclr=new JButton("Clear");
bsub=new JButton("Submit");
l1.setBounds(30,30,150,30);
l2.setBounds(30,70,150,30);
t1.setBounds(170,30,150,30);
t2.setBounds(170, 70, 150, 30);
bsub.setBounds(220,120,90,40);
bclr.setBounds(100,120,100,40);
f.add(t1);
f.add(t2);
f.add(l1);
f.add(l2);
f.add(bsub);
f.add(bclr);
f.setLayout(null);
f.setVisible(true);
f.setSize(350,350);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setResizable(false);
bclr.addActionListener(this);
bsub.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
// on submit button
if(e.getSource()==bsub)
{
a=t1.getText();
b=t2.getText();
if(a != "" && b != ""){
new Second();
}
}
// on clear button
if(e.getSource()==bclr)
{
t1.setText("");
t2.setText("");
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new Loginsystem(); //call class
}
}
//code for second window
class Second implements ActionListener {
JFrame f;
Timer timer = new Timer(1000,this);
JButton bstart,bbreaki,bbreako,bend;
Second()
{
f=new JFrame("Login System-window2");
bstart=new JButton("Start shift");
bbreaki=new JButton(" Break In");
bbreako=new JButton(" Break out");
bend=new JButton(" End Shift");
bstart.setBounds(30,30,100,30);
bbreaki.setBounds(150,30,100,30);
bbreako.setBounds(270,30,100,30);
bend.setBounds(390,30,100,30);
f.add(bstart);
f.add(bbreaki);
f.add(bbreako);
f.add(bend);
f.setLayout(null);
f.setVisible(true);
f.setSize(550,150);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setResizable(false);
bstart.addActionListener(this);
bbreaki.addActionListener(this);
bbreako.addActionListener(this);
bend.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
if(e.getSource()==bstart)
{
timer.start();
}
if(e.getSource()==bbreaki)
{
timer.stop();
}
if(e.getSource()==bbreako)
{
timer.stop();
}
if(e.getSource()==bend)
{
timer.restart();
}
}
}