Anda di halaman 1dari 46

JAVA PROGRAM

1. GRADE CALCULATOR

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
double a=Double.parseDouble(n1.getText());
if(a>=90)
n2.setText("A GRADE");
else if (a>=75 && a<90)
n2.setText("B GRADE");
else if(a>=40 && a<75)
n2.setText("C GRADE");
else if (a>=35 && a<40)
n2.setText("D GRADE");
else
n2.setText("FAIL");
2. FEES CRITERIA

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String a=t1.getText();
int s;
if(r1.isSelected())
{s=500;
if(c1.isSelected())
s=0;}
else
s=1000;
t2.append("NAME:"+a+"\n");
t2.append("FEES:"+s);
3. INTEREST CALCULATOR

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int a= Integer.parseInt(t1.getText());
int b= Integer.parseInt(t2.getText());
int c= Integer.parseInt(t3.getText());
if(r1.isSelected())
{if(b<=1)
c=10;
else if(b>1 && b<=5)
c=12;
else
c=15;}
else{
if(b<=2)
c=11;
else if(b>2 && b<=7)
c=12;
else
c=15;}
float s;
s=((1+c/100)*b)*a;
float d= a+s;
t4.setText(""+s);
t5.setText(""+d);}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
r1.setSelected(false);
r2.setSelected(false);
c1.setSelected(false);}
4. MARKS CALCULATOR

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
float a= Float.parseFloat(t1.getText());
float b= Float.parseFloat(t2.getText());
float c= Float.parseFloat(t3.getText());
float d= Float.parseFloat(t4.getText());
float e= Float.parseFloat(t5.getText());
float f= a+b+c+d+e;
t6.setText("YOUR MARKS OUT OF 500 ARE:"+f);
float y= f*100/500;
t7.setText("YOUR PERCENTAGE IS:"+y);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);

5. SIMPLE CALCULATOR

DESIGN PAMPHLET
OUTPUT SCREEN

CODE FOR ABOVE RESULT


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int a= Integer.parseInt(t1.getText());
float b= Float.parseFloat(t2.getText());
float c= Float.parseFloat(t3.getText());
switch(a)
{case 1:
float d=b+c;
t4.setText(""+d);
break;
case 2:
float u=b-c;
t4.setText(""+u);
break;
case 3:
float y=b*c;
t4.setText(""+y);
break;
case 4:
float o=b/c;
t4.setText(""+o);
break;
default:
t4.setText("wrong choice");
break;
}
}

6. STUDENT RECORD

DESIGN PAMPHLET
OUTPUT SCREEN

CODE FOR ABOVE RESULT


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
float f = Float.parseFloat(t1.getText());
float s = Float.parseFloat(t2.getText());
float i = f + s;
float h = i / 2;
float p;
if (c1.isSelected()) {
if (h != 100) {
p = h + 3;
} else {
p = h;
}
}
{
t3.setText("" + h);
}

}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
String g;
float f= Float.parseFloat(t1.getText());
float s= Float.parseFloat(t2.getText());
float i= f+s;
float h=i/2;
if(r1.isSelected())
{ if(h>=80 && h<100)
g="A";
else if(h>=60 && h<80)
g="B";
else{
g="C";
} if(r2.isSelected())
{
if(h>=75)
g="A";
else if(h>=60 && h<75)
g="B";
else
g="C";
}
t3.setText(""+h);
t4.setText(""+g);
}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {


System.exit(0);

7. TOTAL WAGE CALCULATOR


DESIGN PAMPHLET

OUTPUT SCREEN

CODE FOR ABOVE RESULT


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int a= Integer.parseInt(t2.getText());
int b;
int c=0;
if(r1.isSelected())
b=150;
else b=170;
if(c1.isSelected())
c=b+100;
else
c=b;
{if(r3.isSelected())
c=(b)-(b*10)/100;
else
c=(b+100);
}
int f= a*c;
t3.setText(""+f);

}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
t1.setText("");
t2.setText("");
t3.setText("");
c1.setSelected(false);
r1.setSelected(false);
r2.setSelected(false);
r3.setSelected(false);
r4.setSelected(false);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

8. SALARY CALCULATOR
DESIGN PAMPHLET

OUTPUT SCREEN

CODE FOR ABOVE RESULT


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int a= Integer.parseInt(t1.getText());
int b,c;
if(r1.isSelected())
b= 10*a/100;
else if(r2.isSelected())
b= 20*a/100;
else
b=30*a/100;
c= a-b;
t2.setText(""+b);
t3.setText(""+c);
}
9. SERVICE AND NET PRICE CALCULATOR

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
float a= Float.parseFloat(t2.getText());
float b= Float.parseFloat(t3.getText());
float ab= a*b;
t4.setText(""+ab);
float sc;
if(r1.isSelected())
sc= 10*ab/100;
else if(r2.isSelected())
sc=15*ab/100;
else
sc=20*ab/100;
t5.setText(""+sc)
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
float ab= Float.parseFloat(t4.getText());
float sc= Float.parseFloat(t5.getText());
float np=sc+ab;
t6.setText(""+np);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
10. FIBONACCI SERIES

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int n= Integer.parseInt(t1.getText());
int a=0,c=0;
int b=1;
System.out.println(""+a+""+b);
while(c<=n)
{
c=a+b;
System.out.println(""+c);
a=b;
}

}
11. FIBONACCI SERIES

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int a= Integer.parseInt(t1.getText());
int i,c=0;
for(i=2;i<a;i++)
{if(a%i==0)
c=1;
}
{if(c==1)
t2.setText("Not a prime");
else
t2.setText("Prime");
}
}
12. PIZZA CAFÉ

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String a= t1.getText();
int b= Integer.parseInt(t2.getText());
if (r1.isSelected())
{ if(c1.isSelected())
t3.setText(""+(200+12)*b);
if(c2.isSelected())
t3.setText(""+(200+13)*b);
if(c3.isSelected())
t3.setText(""+(200+15)*b);

t3.setText(""+200*b);
}
else if(r2.isSelected())
{ if(c1.isSelected())
t3.setText(""+(500+12)*b);
if (c2.isSelected())
t3.setText(""+(500+13)*b);
if (c2.isSelected())
t3.setText(""+(500+15)*b);

t3.setText(""+500);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
t1.setText("");
t2.setText("");
t3.setText("");
t3.setText("");
r1.setSelected(false);
r2.setSelected(false);
c1.setSelected(false);
c2.setSelected(false);
c3.setSelected(false);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
13. PATTERN 1

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int i,j;
for(i=1;i<=5;i++)
{System.out.println("");
for(j=1;j<=4;j++)
System.out.println("*");}
}
14. PATTERN 2

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int i,j;
for(i=1;i<=5;i++)
{System.out.println("");
for(j=1;j<=4;j++)
System.out.print("*");
}
15. PATTERN 3

DESIGN PAMPHLET

OUTPUT SCREEN
CODE FOR ABOVE RESULT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int i,j;
for(i=4;i>=1;i--)
{System.out.println("");
for(j=1;j<=i;j++)
System.out.print("*");
}
SQL QUERIES
Write Queries based on EMP table including following
EMP (EMPID, EMPNAME, DESIG, SAL, GRADE, DOB, DOJ, CITY)
1)Create database and open the database.

2)Create the table EMP with constraints(Primary key, not null, unique,
default)

3)Describe the structure of the created table

4)Insert at least 5 records

5)Make a simple query using where clause including relational operators and
logical operators
6)Make a simple query using all keyword.

7)Make a simple query using distinct keyword.

8)Show all records from EMP where the name contains the letter A.

9)Show all records from EMP where the name does not contain the letter A.

10)Show all records from EMP where the employee ID is between 1 and 3.

11)Show all records from EMP where employee ID is not between 1 and 3.

12)Show all records from EMP where Empname is either in Noida or Delhi.
13) Show all records from EMP where Empname is not either in Noida or Delhi.

14)Update table and set salary=100 where empname is Dhruv.

15)Alter table and change column sal to _salary_

16)Delete the column grade

17)Add column age.

18)Change null values in age column with some data.

19)Show day name of date of joining.

20)Display month of date of joining of employee Chirag.


21)Display year of date of joining of employees where salary>10000.
22)What is the remainder when employee ID of employee Dhruv is divided by 2.
23)write a query to display salary raised to employee ID of employee Dhruv.
24)Display sign of employee IDs.
25)Display empnames in lower case.
26)Join empname and desig of all employees.
27)Show length of Designation of employees where empid is greater than 2.
28)Display sum of salary of all employees.
29)Display max salary of all employees.
30)Display min salary of all employees.

Anda mungkin juga menyukai