System Analysis and Design Lab 6: Import Java - Sql. Import Javax - Swing.
System Analysis and Design Lab 6: Import Java - Sql. Import Javax - Swing.
Question 1: Part A Write a program that adds 2 numbers using AWT components
Use the following libraries: import java.sql.*; import javax.swing.*; Use Integer.parseInt() function to convert to integer value
Question 1: Part B Modify the above program to include the Subtraction, division and Multiplication of the two numbers
Question 2: Part A Create 2 tables Employee and Department where each employee works in one department and the department includes many employees. Add the appropriate attributes in each table. Insert 2 records in each table.
Question 2: Part B Create a java application that asks the user for the employee Id and Retrieve the Corresponding employees name
The following code will be used for the connection between the application side and the database created: Connection con = null; Statement st= null; ResultSet rs= null; try { con = DriverManager.getConnection("jdbc:derby://localhost:1527/Databasename", "username", "password");
st= con.createStatement(); rs= st.executeQuery("your Select statement is placed here ); while (rs.next()) { //code for retrieving the result } con.close(); } catch (Exception e) { System.err.println("Exception: "+e.getMessage()); }
Question 2: Part C Modify the program in part B to allow user to insert records in the database through the java interface
Question 2: Part D Modify the program in part C to allow user to retrieve the Department Name in which the employee works in. Your select statement is a join statement between table employee and table department.