Académique Documents
Professionnel Documents
Culture Documents
INFORMATICS PRACTICES
RECORD BOOK
NAME: .
CLASS :
BONAFIDE CERTIFICATE
Roll.No:
PRINCIPAL
CONTENTS
Page
Sl.No Programs
Numbers
GUI application to change the colour of a label box, a textfield and a
1.
button
GUI application that allows the user to enter the weight in a text box
4.
and calculate the postage
GUI application that allows the user to enter the sales amount in a
5.
text box and calculate the commission using (if) statement
6. GUI application that returns the sum of the digits using while loop
13. GUI application to change the first letter of a sentence to upper case
MySQL QUERIES
HTML PROGRAMS
Source Code :
Color c= Color.WHITE;
int a=l1.getSelectedIndex();
switch(a)
{ case 0 :
c=Color.RED; break;
case 1 : c=Color.GREEN;
break; case 2 :
c=Color.ORANGE;break;
case 3 :
c=Color.YELLOW;break;
case 4 :
c=Color.BLUE; break;
case 5 :
c=Color.GRAY; break;
case 6 :
c=Color.BLACK;break;
}
if(chklb.isSelected())
lb.setBackground(c);
else
lb.setBackground(Color.WHITE);
if(chktb.isSelected())
tb.setBackground(c);
else
tb.setBackground(Color.WHITE);
if(chkb.isSelected())
b.setBackground(c);
else
b.setBackground(Color.WHITE);
Output :
2. Design an application to display a stopwatch
Source Code:
}
});
t.start();
Output :
3. Create a four function calculator
Source Code:
int a =Integer.parseInt(t1.getText());
int b =Integer.parseInt(t2.getText());
String c =new String(t3.getText());
int d = 0;
if (c.equals("+")) {
d = a+b;}
if (c.equals("-")) {
d = a-b;}
if (c.equals("*")) {
d = a*b;}
if (c.equals("/")) {
if(b==0){
JOptionPane.showMessageDialog(this,Division by zero is not possible);}
else{
d = a/b;}}
r.setText(""+ d);
Output :
4. Design an application that allows the user to enter the weight in a text
box and calculate the postage
Source Code:
float a = Float.parseFloat(t1.getText());
double p=0;
if(a<=15){
r.setText("The Postage is Rs. 1.40/-");
}
else if(a<=100){
r.setText("The Postage is Rs. 2.70/-");
}
else if(a<=250){
r.setText("The Postage is Rs. 4.00/-");
}
else if(a<=500){
r.setText("The Postage is Rs. 7.50/-");
}
else if(a>500){
p=(a*0.02);
r.setText("The Postage is Rs. "+p+"/-");
}
else
{
JOptionPane.showMessageDialog(Enter the weight);
}
Output :
5. To calculate the commission using (if) statement
Source Code:
String txt=t1.getText();
double sales,commision;
sales=Double.parseDouble(txt);
if(sales>30000)
commision=sales*0.15;
else
if(sales>22000)
commision=sales*.10;
else{
if(sales>12000)
commision=sales*0.07;
else{
if(sales>5000)
commision=sales*0.03;}
else
commision=0;}
result.setText("The Commision is Rs "+commision+"/-");
Output :
6. Create an application that returns the sum of the digits using while loop
Source Code:
int n =Integer.parseInt(t1.getText());
int a ;
int r =0;
while (n !=0)
{ a = n % 10;
r =r+a;
n =n /10;
re.setText(""+r);
}
Output :
7. Create an application that obtains number as argument and displays
reverse of the number
Source Code:
Generated Code
int rev(int n)
{ int a= 0;
int r=0;-
while (n !=0)
{ a = a % 10;
r =r*10+a;
n=n/10;
}
return r;
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int n =Integer.parseInt(t1.getText());
int b=rev(n);
re.setText(""+b);
}
Output :
8. To find the reverse of a string
Source Code:
String a=t1.getText();
String b="";
for(int i=a.length()-1;i>=0;i--){
b=b+a.charAt(i);
}
JOptionPane.showMessageDialog(this, "Reverse Of The Character "+a+" is "+b);
Output :
9. To find the number of vowels in a string
Source Code:
int a = s.length();
String d = new String();
d= s.toLowerCase();
int c=0;
while(a>0)
{
char b=d.charAt(a-1);
if((b=='a') ||( b=='e' )||( b=='i') ||( b=='o') ||( b=='u'))
{ c++;}
a--;
}
return c;
}
Output :
10. To enter records in a jTable
Source Code:
Object[] t ={t1.getText(),t2.getText()};
DefaultTableModel m =(DefaultTableModel)j.getModel();
m.addRow(t);
t1.setText("");
t2.setText("");
DefaultTableModel m =(DefaultTableModel)j.getModel();
int a =Integer.parseInt(t3.getText());
m.removeRow(a-1);
Output :
11. To find the occurrence of a particular word
Source Code:
String s=t1.getText();
char c=t2.getText().charAt(0);
int count=0;
for(int i=0;i<s.length();i++)
{
if(s.charAt(i)==c)
count++;
}
JOptionPane.showMessageDialog(this,"Occurance Of The Character "+s+" is "+count);
Output :
12. To find sum, maximum, average of three numbers using method
Source Code:
Output :
13. To change the first letter of a sentence to upper case
Source Code:
String str=t1.getText();
int len=str.length();
char ch=Character.toUpperCase(str.charAt(0));
str=ch+str.substring(1);
for(int i=2;i<len-1;i++)
{
if(str.charAt(i)==' ')
{
ch=Character.toUpperCase(str.charAt(i+1));
str=str.substring(0,i+1)+ch+str.substring(i+2);
}
}
JOptionPane.showMessageDialog(null,str);
Output :
14. To find nCr of a number
Source Code:
int fact(int n)
{int p=1;
for(int i =1; i<= n ; i++)
{p* = i ;}
return p;
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int n=Integer.parseInt(t1.getText());
int r=Integer.parseInt(t2.getText());
int c=n-r;
int factn=fact(n);
int factr=fact(r);
int factc=fact(c);
int ncr = (factn /(factc*factr));
r1.setText(" "+ncr);
}
Output :
15. Create an application that returns whether a particular string is a
palindrome or not
Source Code:
Source Code:
class employee
{int empno;
String empname;
String empdesig;
public employee()
{empno =0;}
OUTPUT
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;
if(rs.next())
{
String a=rs.getString("Dept_No");
String b=rs.getString("Dept_Name");
String c=rs.getString("Location");
t2.setText(b);
t3.setText(c);
b2.setEnabled(true);
b3.setEnabled(true);
b4.setEnabled(true);
}
else{
JOptionPane.showMessageDialog(null,"No Records Found");
}
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e.getMessage());}
}
18. To insert a record using mysql
Source Code:
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;
Output :
19. To update a record using mysql
Source Code:
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;
Output :
20. To delete a record using mysql
Source Code:
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;
Output :
MY SQL
1. Write a query to create a database.
Create database employee;
Create table emp(emp_no int(2) not null primary key,ename varchar(10), job
varchar(20), salary int(6) default=1000, commission int(5), dept_no int(2));
10. Write a query to display all the details of employees who belong to dept_no 34.
11. Write a query to display the details of employee where name starts with E.
select * from emp where ename like e%;
12. Write a query to display the details of employee whose salary between 10000
and 40000.
select * from emp where salary between 10000 and 40000;
13. Write a query to count the number of rows in the emp table.
select count(*) from emp;
14. Write a query to find the sum of salary of employee in the department number
87 and 94.
select sum(salary) from emp where dept_no in (87 ,94);
15. Write a query to find the maximum salary of employee whose name starts with
H;
select max(salary) from emp where ename like h%;
16. Write a query to find the average salary of employee in the department number
87 and 94.
select avg(salary) from emp where dept_no in (87 ,94);
17. Write a query to display the number of employee and sum of salary group by
department number.
select dept_no, count(*), sum(salary) from emp group by dept_no;
19. Write a query to display employee name, sum of salary group by employee
name and order the rows by employee name is descending order.
select ename,sum(salary) from emp group by ename order by ename desc;
20. Write a query to create a table customer with the following data.
Column name Datatype Constraints
Cust_no Int(2) Not null primary key
Cust_id Int(10) -
Cust_name Varchar(20) -
Dept_no Int(2) Foreign key
create table customer(Cust_no int(2) not null primary key, Cust_id int(10),
Cust_name varchar(20), foreign key(Dept_no) references emp(Dept_no) on delete set
null);
1 101 Anu 10
2 102 Athira 30
3 103 Anitha 34
4 104 Arunima 25
5 105 Anjali 98
22. Write a query to display customer number, customer name and corresponding
employee name for each customer.
Select c.cust_no, c.cust_name, e.ename from customer c, emp e where
c.dept_no=e.dept_no;
25. Write a query to display customer id, customer name for customers having
department number 10.
Select cust_id, cust_name from customer group by dept_no having dept_no = 10;
26. Write a query to make customer id as the primary key of the table customer.
Alter table customer add primary key(cust_id);
27. Write a query to increase the length of customer name column from 20 to 30.
Alter table customer modify cust_name varchar(30);
28. Write a query to change column customer number to scl_no of the table
customer.
Alter table customer change cust_no scl_no int(5);
<html>
<head>
<title>
Global Warming
</title>
</head>
<body bgcolor="yellow"link="magenta"alink="purple"vlink="orange">
<h1 align="center">
<font face="Monotype Corsiva" color="red" size="10">
GLOBAL WARMING
</font>
</h1>
<hr align="center"noshade size="2"width="500"color="brown">
<img src="global_warming_panic1.jpg" border="1" align="middle" height="300"
width="300">
<p align="justify" >
<font color="blue" size="6">
<b>Global warming</b> is the rise in the average temperature of the Earth's climate system
and its related effects.Over the past 50 years, the average global temperature has increased
at the fastest rate in recorded history.
</font>
</p>
<h2 size=7>
<i>
<u>
CAUSES
</u>
</i>
</h2>
<font size="6">
<ul type=square>
<li>Greenhouse gases</li>
<li>Aerosols and soot</li>
<li>Solar activity</li>
</ul>
<h3 >
EFFECTS
</h3>
<ol start="24"type="A">
<li>Extreme weather</li>
<li>Sea level rise</li>
<li>Habitat inundation</li>
</ol>
For more details,log on to
<br>
<a href="https://www.google.com">
Global warming
</a>
</font>
</body>
</html>
2.Create a webpage having a table containing student details
<html>
<head>
<title>
School
</title>
</head>
<body>
<h1 align="center">
<font face="Comic Sans MS" color="purple" size="10">
Student details
</h1>
<hr align="center"noshade size="2"width="500"color="brown">
<table border="2"align="center"cellpadding="7"cellspacing="10">
<tr>
<th bgcolor="#E3E4FA">ADMN. NO:</th>
<th bgcolor="#E3E4FA">NAME</th>
<th bgcolor="#E3E4FA">TOTAL MARKS</th>
</tr>
<tr>
<td>2456</td>
<td>Shyam</td>
<td>97</td>
</tr>
<tr>
<td>4567</td>
<td>Kiran</td>
<td>84</td>
</tr>
<tr>
<td>3789</td>
<td>Nayana</td>
<td>60</td>
</tr>
<tr>
<td>3568</td>
<td>Anupama</td>
<td>77</td>
</tr>
</table>
</body>
</html>
3.Create a html document with form
<html>
<head>
<title>form
</title>
</head>
<body>
<form name="newform" action="globalwarming.html"method="get">
<b>ADMISSION ENQUIRY FORM</b>
<br>
Name
<input type="text"name="tf1">
<br>
Gender
<input type="radio" name="r1" >Male
<input type="radio" name="r2" >Female
<br>
E=mail
<input type="text" name="tf2 ">
<br>
Stream
<input type="checkbox" name="c1" >Science
<input type="checkbox" name="c2" >Commerce
<br>
Comments
<br>
<textarea name="comment" rows="5"cols="50">
</textarea>
<br>
<input type="button"name="b1"value="Submit">
<input type="button"name="b2"value="Reset">
</form>
</body>
</html>
AD:\IISSIOX EXQL"'IRY FOR.\I
X.u=I I
Gniikl-
E=rruul
).{alc 9F =--
Strram 8 Sc,mcr fiJ Comm=c
Comments
---- -
I Submrt]IReseq
J
NETWORK CONFIGURATION
AND
OPEN SOURCE SOFTWARE
OPEN SOURCE SOFTWARE
Definition: The categories of software / programs whose licenses do not impose much
condition.
Features:
1. Freedom to run and use the software.
2. Modify the program.
3. Redistribute copies of either original or modified program(without paying royalties to
previous developers). It can be freely used for modifications, but it does not have to
be free of charge. Its source code is available.
MySQL Clients:
MySQL clients are programs that connect to the MySQL server and issue queries in a
pre-specified format.
MySQL is compatible with the standards based SQL. The client program may contact
the server programmatically or manually.
Features of MySQL:
1. Speed: If the server hardware is optimal, MySQL runs very fast.
2. Ease of use: MySQL is a high performance, relatively simple database system.
3. Cost: Available free of cost.
4. Query Language Support: Understands standard based SQL.
5. Portability: Provides portability as it has been tested with a broad range of different
compiler and can work on many different platforms.
6. Data Types: Provide many data types to support different types of data.
7. Security: Offers a privilege and password system that is very flexible and secure.
8. Localization: The server can provide error messages to clients in many languages.
9. Connectivity: Clients can connect to MySQL server using several protocols.
10. Client and Tools: Provides command line programs such as mysql dump and
mysql admin, and graphical programs such as MyQL Administrator and MySQL
Query Browser.
Advantages of MySQL:
1. Reliability and performance: MySQL is very reliable and high performance
relational database management system.
2. Availability of source: MySQL source code is available that is why now we can
recompile the source code.
3. Cross-platform support: MySQL supports more than twenty different platforms
including the major Linux distribution. Mac OS X, UNIX and Microsoft Windows.
4. Powerful uncomplicated software: The MySQL has most capabilities to handle
most corporate database applications and is very easy and fast.
5. Integrity: MySQL provides forms of integrity checking.
6. Authorization: MySQL DDL includes commands for specifying access rights to
relations and views.