Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class called Employee whose objects are records for an employee. This c

ID: 3625722 • Letter: C

Question

Create a class called Employee whose objects are records for an employee. This class will be a derived class of the class Person which you will have to copy into a file of your own and compile. An employee record has an employee's name (inherited from the class Person), an annual salary represented as a single value of type double, a year the employee started work as a single value of type int and a national insurance number, which is a value of type String.
Give your class a reasonable number of constructors and accessor methods, as well as an equals method. Write another class containing a main method to fully test your class definition.

Explanation / Answer

class ConnectData { private Connection connection = null; private Statement statement = null; private ResultSet resultSet = null; private PreparedStatement prepareSet = null; private String driver = "org.hsqldb.jdbcDriver"; private String URL = "jdbc:hsqldb:file:test"; ConnectData() { try { Class.forName(driver); connection = DriverManager.getConnection(URL); } catch (ClassNotFoundException SQLe) { JOptionPane.showMessageDialog(null, SQLe.toString(), "Error", JOptionPane.ERROR_MESSAGE); } catch (Exception ex) { JOptionPane.showMessageDialog(null, ex.toString(), "Error", JOptionPane.ERROR_MESSAGE); } //start photo class Photo extends JTextField { Image img; public Image Photo (String ph) { if (ph == null) JOptionPane.showMessageDialog(null, "No Data", "Error", JOptionPane.ERROR_MESSAGE); else img = this.getToolkit().getImage(ph); return img; } public void paint (Graphics g) { g.drawImage(img, 0, 0, 200, 200, this); } } else if(stringChoose=="BROWSE IMAGE") { int option = myFileChooser.showOpenDialog(Employee.this); String dir = myFileChooser.getCurrentDirectory().toString(); myStrPhoto = dir+"\"+((myFileChooser.getSelectedFile() !=null)? myFileChooser.getSelectedFile().getName():"nothing"); if (option == JFileChooser.APPROVE_OPTION) { myFoto.setIcon(new ImageIcon(photo.Photo(myStrPhoto))); } } try{ String sql_tambah = "INSERT INTO Employee "+ "VALUES('"+ a +"','"+ b +"','"+c+"','"+d+"','"+myStrPhoto+"')"; dt = new ConnectData(); dt.prepareSet(sql_tambah); tampilData(); clearText(); }catch(Exception se){ JOptionPane.showMessageDialog(null,"Data Exist"); } try{ String sql_ubah = "UPDATE Employee "+ "SET Name = '"+ bb +"',Adress = '"+ cc +"',Note='"+dd+"',Photo='"+myStrPhoto+"' WHERE NoID = '"+ aa +"'"; dt = new ConnectData(); dt.prepareSet(sql_ubah); tampilData(); clearText(); }catch(Exception se){ JOptionPane.showMessageDialog(null,"Failed to Update "+se); } MouseAdapter ma = new MouseAdapter(){ public void mouseClicked(MouseEvent me){ ambilData(); myButtoninput.setEnabled(false); myButtonedit.setEnabled(true); myButtondelete.setEnabled(true); myButtonkosong.setEnabled(true); } }; KeyAdapter ka = new KeyAdapter(){ public void keyPressed(KeyEvent ke){ ambilData(); myButtoninput.setEnabled(false); myButtonedit.setEnabled(true); myButtondelete.setEnabled(true); myButtonkosong.setEnabled(true); } }; myDataTable.addKeyListener(ka); myDataTable.addMouseListener(ma); }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote