0% found this document useful (0 votes)
9 views

System Analysis and Design Lab 6: Import Java - Sql. Import Javax - Swing.

This document outlines questions for a system analysis and design lab assignment. It includes questions about: 1) Creating a Java program to perform basic math operations (add, subtract, multiply, divide) on two numbers entered by the user. 2) Creating database tables for employees and departments, inserting sample records, and developing a Java program to lookup an employee's name based on their ID and allow the user to insert new records. 3) Modifying the Java program to also display the department name for an employee by joining the employee and department tables.

Uploaded by

007wasr
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

System Analysis and Design Lab 6: Import Java - Sql. Import Javax - Swing.

This document outlines questions for a system analysis and design lab assignment. It includes questions about: 1) Creating a Java program to perform basic math operations (add, subtract, multiply, divide) on two numbers entered by the user. 2) Creating database tables for employees and departments, inserting sample records, and developing a Java program to lookup an employee's name based on their ID and allow the user to insert new records. 3) Modifying the Java program to also display the department name for an employee by joining the employee and department tables.

Uploaded by

007wasr
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

System Analysis and Design Lab 6

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.

You might also like