It Class 11
It Class 11
On
Information Technology
Subject Code: 802
Submitted By:
Name:________________
Class:________________
RNO:________________
Submitted To:
Name: Mr. Raj Kumar Verma
Designation: PGT (Computer Science)
(Department of Computer Science)
1
num2=Integer.parseInt (txtnum2.getText () );
multiplication=num1*num2;
txtmutilplication.setText (""+multiplication) ;
}
private void jButton1ActionPerformed (java.awt.event.ActionEvent evt)
{
int num1, num2, division;
num1=Integer.parseInt (txtnum1.getText () );
num2=Integer.parseInt (txtnum2.getText () );
division=num1/num2;
txtdivision.setText (""+division) ;
}
private void jButton1ActionPerformed (java.awt.event.ActionEvent evt)
{
int num1, num2, remainder;
num1=Integer.parseInt (txtnum1.getText () );
num2=Integer.parseInt (txtnum2.getText () );
remainder=num1%num2;
txtremainder.setText (""+remainder) ;
}
2
3
#3: Design a GUI application to calculate Simple Interest
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
float p,r,t,si;
p=Float.parseFloat(t1.getText());
r=Float.parseFloat(t2.getText());
t=Float.parseFloat(t3.getText());
si=p*r*t/100;
res.setText(""+si);
}
#4: Design a GUI application to calculate the sum of digits of three digit
number. Hint : Suppose user enters 123 the output should be 6(1+2+3).
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
int sum,r1,r2,r3,num;
num=Integer.parseInt(txt1.getText());
r1=num%10;
num=num/10;
r2=num%10;
num=num/10;
r3=num%10;
num=num/10;
sum=r1+r2+r3;
txt2.setText(sum+"");
}
4
5
#5: Design a GUI application to check whether the entered number is even
or odd
private void btnActionPerformed(java.awt.event.ActionEvent evt)
{
int a;
a=Integer.parseInt(txt.getText());
if (a%2==0)
txt1.setText("even");
else
txt1.setText("odd");
}
6
7
#7: Design a GUI application in java to convert temperature from Celsius to
Fahrenheit or vice versa.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
float a,f;
a=Float.parseFloat(cel.getText());
f=(a*9/5)+32;
fer.setText(""+f);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
float a,c;
a=Float.parseFloat(fer.getText());
c=(a-32)*5/9;
cel.setText(""+c);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
{
cel.setText("");
fer.setText("");
}
8
9
#8: Design a GUI application to perform an operation based on the criteria
input by the user in a radio button
a=Integer.parseInt(n1.getText());
b=Integer.parseInt(n2.getText());
c=a+b;
txtRes.setText(""+c);
}
//Code to perform Subtraction
private void rbSUBActionPerformed(java.awt.event.ActionEvent evt)
{
int a,b,c;
if (rbSUB.isSelected()) // Now state of subtract radio button will be true
{
rbADD.setSelected(false); /*
rbMUL.setSelected(false);
rbDIV.setSelected(false); set state of others radio buttons to false
rbREM.setSelected(false); */
a=Integer.parseInt(n1.getText());
b=Integer.parseInt(n2.getText());
c=a-b;
txtRes.setText(""+c);
10
}
}
a=Integer.parseInt(n1.getText());
b=Integer.parseInt(n2.getText());
c=a*b;
txtRes.setText(""+c);
}
}
//Code to perform division
private void rbDIVActionPerformed(java.awt.event.ActionEvent evt)
{
int a,b;
float c;
if (rbDIV.isSelected()) //Now state of division radio button is set to true
{
rbADD.setSelected(false); /*
rbSUB.setSelected(false); Same code
rbMUL.setSelected(false);
rbREM.setSelected(false); */
a=Integer.parseInt(n1.getText());
b=Integer.parseInt(n2.getText());
c=(float)a/b;
txtRes.setText(""+c);
11
}
}
//Code to find out remainder
private void rbREMActionPerformed(java.awt.event.ActionEvent evt)
{
int a,b,c;
if (rbREM.isSelected()) //Now state of remainder radio button is set to true
{
rbADD.setSelected(false); /*
rbSUB.setSelected(false); Same code
rbMUL.setSelected(false);
rbDIV.setSelected(false); */
a=Integer.parseInt(n1.getText());
b=Integer.parseInt(n2.getText());
c=a%b;
txtRes.setText(""+c);
}
12
13
#9: Design a GUI application to accept marks of 5 subjects and find out the
total, percentage and also display grade depending on the percentage.
//Code to calculate the total of five subjects
private void btnTotalActionPerformed(java.awt.event.ActionEvent evt)
{ int s1,s2,s3,s4,s5,total;
s1=Integer.parseInt(txtEnglish.getText());
s2=Integer.parseInt(txtMath.getText());
s3=Integer.parseInt(txtScience.getText());
s4=Integer.parseInt(txtSST.getText());
s5=Integer.parseInt(txtIT.getText());
total=s1+s2+s3+s4+s5;
txtTotal.setText(total+"");
}
//Code to find out the Percentage and analyze the grade on the basis of percentage via
if-else-if statement
private void btnPerActionPerformed(java.awt.event.ActionEvent evt)
{ float per;
per=Float.parseFloat(txtTotal.getText())/5;
txtPer.setText(per+"");
if(per>=90)
lbl2.setText("A+");
else if (per>=85 && per<90)
lbl2.setText("A");
else if(per>=80 && per<85)
lbl2.setText("B+");
else if(per>=75 && per<80)
lbl2.setText("B");
else
lbl2.setText("C"); }
14
15
#10: Design a GUI application to check whether the entered character is
Vowel or Consonant
private void btnChkActionPerformed(java.awt.event.ActionEvent evt)
{
char ch;
ch=txtChar.getText().charAt(0);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
txtChar.setText("It is a Vowel");
else
txtChar.setText("It is a consonant");
}
//Code to clear the textbox.
private void txtClearActionPerformed(java.awt.event.ActionEvent evt)
{
txtChar.setText("");
}
Q: What will happen if you will input vowel in capital letter?
Ans: You have to write conditions for both small and capital letters like:
if( (ch=='a'|| ch==’A’) || (ch=='e'|| ch==’E’) || (ch=='i' || ch==’I’) || (ch=='o'||ch==’O’) ||
(ch=='u' || ch==’U’) )
txtChar.setText("It is a Vowel");
else
txtChar.setText("It is a consonant");
16
17
#11: Design a GUI application to find out greatest among three numbers by
using Logical and relational Operators
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
int a,b,c;
a=Integer.parseInt(txtNum1.getText()); //code to convert string to integer
b=Integer.parseInt(txtNum2.getText());
c=Integer.parseInt(txtNum3.getText());
if(a>b&&a>c)
lbl.setText(a+" is greatest");
else if(b>a&&b>c)
lbl.setText(b+" is greatest");
else
lbl.setText(c+" is greatest");
}
#12: Design a GUI application to check whether the year is leap year or not.
private void btn1ActionPerformed(java.awt.event.ActionEvent evt)
{
int year;
year=Integer.parseInt(txt1.getText());
if(year%400==0||(year%4==0&&year%100!=0))
txt2.setText("leap year");
else
txt2.setText("not a leap year");
}
18
19
#13: Design a GUI application to display the day of the week via multi-way
decision making statement.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
int choice;
choice=Integer.parseInt(day.getText());
switch(choice)
{
case 1:
week.setText("Monday");
break;
case 2:
week.setText("Tuesday");
break;
case 3:
week.setText("Wednesday");
break;
case 4:
week.setText("Thursday");
break;
case 5:
week.setText("Friday");
break;
case 6:
week.setText("Saturday");
break;
case 7:
week.setText("Sunday");
break;
default:
week.setText("Wrong Input");
break;
20
21
#14: Design a GUI application to demonstrate the working of Combo Box
si=(pri*roi*time)/100;
res.setText(si+"");
22
23
#1: Write a SQL query to create database
24
#3: Write a SQL query to insert values into a table
25
#5: Write a SQL query to display specific columns
26
#7: Write a SQL query to display records of teachers having
salary greater than 50000
27
#9: Write a SQL query to sort the records by “Salary”
in descending order
28
#11: Write a SQL query to display the records of
"Female Teachers"
29
#13: Write a SQL query to display the records of
teachers whose name starts with alphabet "A"
30
#15: Write a SQL query to add primary key in the table
31
#17: Write a SQL query to delete the particular record.
32
#19: Write a SQL query to show salary between 45000
and 65000
33
#21: Write a SQL queries to display average and total
salary by grouping gender-wise.
34