Академический Документы
Профессиональный Документы
Культура Документы
CLASS- XII-F
ROLL NO- 10
SUBMITTED TO- SAKSHI MAM
SCHOOL- ARMY PUBLIC SCHOOL
1
PROGRAM
ONE----------------------------------------------------------------
---------
Aim : To make a program which appends the information given.
Design :
Output :
2
PROGRAM
TWO---------------------------------------------------------------
---------
Aim : To make a calculator.
Design :
Design :
Design :
Output :
7
PROGRAM
FIVE----------------------------------------------------------------
---------
Aim : To create percentagecalculator.
Design :
Output :
9
PROGRAM
SIX-----------------------------------------------------------------
----------
Aim : To create a registration for placements of job seekers.
Design :
10
else if(femalerb.isSelected())
{ str = "Hello Ms. "+ name.getText()+" you are registered";}
JOptionPane.showMessageDialog(null,str);
For Clear Button :
gradcb.setSelected(false);
intercb.setSelected(false);
pgtcb.setSelected(false); name.setText(null);
malerb.setSelected(false);
femalerb.setSelected(false);
For Close Button :
System.exit(0);
Output :
11
PROGRAM
SEVEN-------------------------------------------------------------
---------
Aim : Design an application in which user enters his chat ID and City
Design :
12
Output :
13
PROGRAM
EIGHT--------------------------------------------------------------
--------
Aim : Practical to illustrate the usage and functionality of String methods.
14
Design :
PROGRAM
NINE---------------------------------------------------------------
---------
16
Aim : To design a simple purpose dialog through the application.
Design :
For OK Button:
System.exit(0);
Output :
17
18
PROGRAM
TEN----------------------------------------------------------------
----------
Aim : To design that decides the eligibility of the user as per his age.
Design :
Output :
20
PROGRAM
ELEVEN-----------------------------------------------------------
----------
Aim : To create a table that can receive input of the user and also display total count of records.
Design :
Output :
22
PROGRAM
TWELVE-----------------------------------------------------------
---------
Aim : To create a table that can receive input of the user and manage an address book.
Design :
PROGRAM
THIRTEEN--------------------------------------------------------
----------
Aim : To create a GUI component that updates and deletes records on a database.
Design :
Code :
if (ans == JOptionPane.YES_OPTION) {
try{stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,”Record successfully updated”); }
catch (Exception e ){
IocTF.setText(“”);
updBtn.setEnabled(false); delBtn.setEnabled(false);}}
JOptionPane.showMessageDialog(null,”Error in deletion!”);}
deptnoTF.setText(“”);
dnameTF.setText(“”); locTF.setText(“”);
Output :
27
PROGRAM
FOURTEEN-------------------------------------------------------
---------
Aim : To create GUI application that obtains search criteria from user and retrieve data from database.
Design :
empTbl.getModel();
if(rows>0)
for(int i =0 ; i<rows; i++) { model.removeRow(0);}}
emptyBtn.doClick();
28
Class.forName(“java.sql.Driver”);
Connection con=
DriverManager.getConnection(jdbc:mysql://localhost/test”,”root”,”friends”);
Statement stmt = con.createStatement(); String sfId =
(String)srchFldCBX.getSelectedItem();
String op = (String)opCBX.getSelectedItem(); String crit = criteriaTF.getText();
String query =”SELECT empno,ename,job,hiredate,sal,deptno FROM empl WHERE”+
sfld +” ”+op+””+ crit +”;”; ResultSet rs = stmt.executeQuery(query);
while(rs.next()){ model.addRow(new Object[] {rs.getInt(1), rs.getString(2), rs.getString(3),
rs.getDate(4), rs.getFloat(5), rs.getInt(6)});}
rs.close();
stmt.close();
con.close();} catch(Exception e ){
PROGRAM
FIFTEEN----------------------------------------------------------
----------
Aim : Consider the table empl given below and run the following Queries.
Queries:
1. List the details of those employees whose annual salary is between
25000 and 40000.
SELECT * FROM empl where sal BETWEEN 2500 AND 4000;
2. Display the name of employees whose name contains ‘A’ as the 4th alphabet.
5. Display details of employees who earn more commission than their salaries.
PROGRAM
SIXTEEN----------------------------------------------------------
----------
Aim : Consider the table EMPLOYEE given below and run the following Queries.
Queries:
1. For record with ID=4 update record with last Name, User ID and Salary.
5. Modify the salary and increases it by 1000, for all who get salary less than 5000.
PROGRAM
SEVENTEEN------------------------------------------------------
---------
Aim : Consider the table STUDENT given below and run the following Queries.
Queries:
1. Display Name, Sex, Percentage of the Students.
3. Display name, age and marks of students whose age is greater than or equal to 14 from student.
4. Display name, age, aggregate of student whose aggregate is between 300 and 400. Order the query in descending order
of name.
SELECT name, age, aggregate FROM student WHERE aggregate BETWEEN 300 AND 400 ORDER BY name DESC;
5. Alias any column name and use that name in another statement.
SELECT name, aggregate/5 “Percentage Marks” FROM student ORDER BY “Percentage NAME”;
35
PROGRAM
EIGHTEEN--------------------------------------------------------
----------
Aim : Join two Tables.
Queries:
1. Write a query to join two tables empl and dept on the basis of field
deptno.
3. Display details like department no, department name, employee number, employee name, job and salary. And order
the rows of by employee number with number.
SELECT empl.deptno, dname, empno, ename, job, sal FROM empl, dept WHERE empl.deptno=dept.deptno GROUP BY empno
ORDER BY empl.deptno, empno;
PROGRAM
NINETEEN--------------------------------------------------------
---------
Aim : Join two Tables.
Queries:
1. Write commands to create the above tables with constraints. Delete on
a primary key should be cascaded to its foreign key.
CREATE TABLE employe (empno INTEGER NOT NULL, salary FLOAT, PRIMARY KEY
(empno)) ENGINE=innodb;
CREATE TABLE employer (ID INTEGER NOT NULL, employee_no INTEGER, FOREIGN KEY(employee_no) REFERNCES
employer(empno) ON DELETE CASCADE) ENGINE=innodb;
2. Write a query to create two tables Tt1 and Tt2, such that a column of the table Tt1 is the foreign key referring to table Tt2
(constraint name fk1).
CREATE TABLE Tt1 (A INTEGER NOT NULL PRIMARY KEY, B INTEGER NOT NULL); CREATE TABLE Tt2 (C INTEGER NOT
ALTER TABLE Tt1 ADD CONSTRAINT fk1 FOREIGN KEY (B) REFERENCES Tt2(C) ON DELETE CASCADE;
38
ALTER TABLE Tt1 DROP PRIMARY KEY;
4. In table empl, add a column named THRIFTPALN of datatype NUMBER with a maximum of 7 digits and two decimal places
anda column named LOANCODE of datatype CHAR with a size of one and integrity constraint that checks that loan code
should be one of these: E, C, H, P.
PROGRAM
TWENTY
<HTML>
<TITLE>TABLE</TITLE>
<BODY>
<TABLE BORDER=“2” WIDTH=“20%”>
<TR ALIGN=“CENTER”>
<TD ROWSPAN=‘4” WIDTH=“20%” ALIGN=“CENTER”>
A<BR> C <BR> G </TD>
<TD COLSPAN=“3” ALIGN=“CENTER”> B</TD>
</TR>
<TR>
<TD ALIGN=“CENTER”> D </TD>
<TD ALIGN=“CENTER”> E </TD>
<TD ALIGN=“CENTER” ROWSPAN=“2”> F </TD>
</TR>
<TR>
<TD ALIGN=“CENTER” COLSPAN=“2”> H </TD>
</TR>
</TABLE>
</BODY>
</HTML>
<HTML<
<BODY>
<TABLE BORDER>
</TR>
<TR>
<TD>A</TD> <TD>B<T/TD> <TD>C</TD>
</TR>
<TR>
<TD>D</TD> <TD>E</TD> <TD>F</TD>
</TR> <
</TABLE>
</BODY>
</HTML>
MADE BY- HARSH NAGESH