Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

1/14/2019

NEW GREEN
FIELD
SCHOOL
INFORMATICS PRACTICES
ALAKNANDA

PROGRAM FILE -
SHIVAM KUMAR JHA | XI-B
11
Contents

1.Acknowledgement

2.Certificate

3.Coding of java
programs

4.My SQL

2
ACKNOWLEDGEMENT
I would like to express my sincere
gratitude to Sir ashok , our IP
teacher for his vital support,
guidance and encouragement,
without whom these project have
not come forth. I would also like to
express my gratitude to my
parents, my sister and friends for
their support during the making of
this project. Last but not the
least,i would like to take this
opportunity to thank our principal
for her invaluable support &for
all facilities made available to us
at the school.

Yours Sincerely,
Shivam kumar jha
(xi-b)

3
CERTIFICATE

This is to certify that SHIVAM


KUMAR JHA of class XI-B, has
done this project under my
supervision and completed it to
my satisfaction.

Sign-_________
Date-__________

4
Q1.Write a program to calculate net sal of an
employee by the following criteria:

CONFIRM CONTRACT
HRA=35% OF BASIC HRA=1000
DA=40% OF BASIC DA=1500
CA=20% OF BASIC CA=700
PF=12% OF BASIC PF=12% OF BASIC
NET SAL=BASIC+HRA+DRA+CA-PF.

int ba, hr, da, ca, pf,n=0;

ba=Integer.parseInt(jTextField2.getText().trim());

if(jComboBox1.getSelectedIndex()==0)

hr=(int) (ba*0.35);

da=(int) (ba*0.4);

ca=(int) (ba*0.2);

pf=(int) (ba*0.12);

else

5
{

hr=1000;

da=1500;

ca=700;

pf=(int) (ba*0.12);

jTextField3.setText(" "+hr);

jTextField4.setText(" "+da);

jTextField5.setText(" "+ca);

jTextField6.setText(" "+pf);

n=ba+hr+da+ca-pf;

jTextField7.setText(" "+11);

Q2.Write a program to calculate simple interest.

int P,R,T,S=0;

P=Integer.parseInt(jTextField1.getText().trim());

R=Integer.parseInt(jTextField2.getText().trim());

6
if (jRadioButton1.isSelected())

T=5;

else if(jRadioButton2.isSelected())

T=10;

else

T=15;

S=(P*R*T)/100;

jTextField3.setText(" "+S);

Q3.Write a program to calculate area of a circle.

float a=0,r;

r=Float.parseFloat(jTextField1.getText().trim());

a=(float) (3.14*r*r);

jTextField2.setText(" "+a);

7
Q4.Write a program to accept the two numbers with
arithmatic operator and calculate result according to
entered operator using the switch case.

int a,b,c=0;

char op;

a=Integer.parseInt(jTextField1.getText().trim());

b=Integer.parseInt(jTextField2.getText().trim());

op=jTextField3.getText().trim().charAt(0);

switch (op)

case'+': c=a+b;

break;

case'-': c=a-b;

break;

default: jTextField4.setText("invalid");

jTextField4.setText(" "+c);

8
Q5.

CALCULATOR

int a,b,c=0;

a=Integer.parseInt(jTextField1.getText().trim());

b=Integer.parseInt(jTextField2.getText().trim());

c=a+b;

jTextField3.setText(" "+c);

int a,b,c=0;

a=Integer.parseInt(jTextField1.getText().trim());

b=Integer.parseInt(jTextField2.getText().trim());

c=a-b;

jTextField3.setText(" "+c);

9
int a,b,c=0;

a=Integer.parseInt(jTextField1.getText().trim());

b=Integer.parseInt(jTextField2.getText().trim());

c=a*b;

jTextField3.setText(" "+c);

int a,b,c=0;

a=Integer.parseInt(jTextField1.getText().trim());

b=Integer.parseInt(jTextField2.getText().trim());

c=a/b;

jTextField3.setText(" "+c);

Q6.Write a program to display your name, city and


state.

10
String na,ct,st;

na=jTextField1.getText().trim();

ct=jList1.getSelectedValue();

st=(String) jComboBox1.getSelectedItem();

jTextArea1.append("you are "+na+"\n");

jTextArea1.append("your city is "+ct+"\n");

jTextArea1.append("your state is "+st+"\n");

Q7.Write a program to calculate cube of an entered


number.

int n,r=0;

n=Integer.parseInt(jTextField1.getText().trim());

r=n*n*n;

jTextField2.setText(" "+r);

11
Q8.Wriite a program to calculate discount and net
amount by following criteria:

Discount
 Cash=10%
 Card=5%
 Cheque=2%
 Membership=5%

int q,r,a,d=0,n;
q=Integer.parseInt(jTextField2.getText().trim());
r=Integer.parseInt(jTextField3.getText().trim());
a=q*r;
jTextField4.setText(" "+a);
if(jRadioButton1.isSelected())
d=(int) (a*0.10);
else if(jRadioButton2.isSelected())
d=(int)(a*0.5);
else if(jRadioButton3.isSelected())
d=(int) (a*0.3);
if(jCheckBox1.isSelected())
d=(int) (d+(a*0.05));
jTextField5.setText(" "+d);
n = a-d;

12
jTextField6.setText(" "+n);

jTextField1.setText(" ");
jTextField2.setText(" ");
jTextField3.setText(" ");
jTextField4.setText(" ");
jTextField5.setText(" ");
jTextField6.setText(" ");

System.exit(0);

Q9.Write a program to check whether the


entered number is divisible by 7 or not.

int n;
n=Integer.parseInt(jTextField1.getText().trim());
if(n%7==0)
jTextField2.setText("it is divisible by 7");
else
jTextField2.setText("it is not divisible by 7");

13
Q10.Write a program to display the sum of n
natural numbers.

int i,n,s=0;
n=Integer.parseInt(jTextField1.getText().trim());
for(i=1;i<=n;i++)
{
s=s+i;
jTextArea1.append(" "+i);
}
jTextArea1.append("\n sum = "+s);

Q11.Write a program to accept a value and


convert it into opposite case.

14
char ch;
ch=jTextField1.getText().trim().charAt(0);
if(ch>='a' && ch<='z')
ch=(char) (ch-32);
else
ch=(char) (ch+32);
jTextField2.setText(" "+ch);

Q12.Write a program to accept the parking hours and


calculate the parking charges on the given criteria:

HOURS<=8(RS 50)
FOR NEXT FOUR HOURS (RS 10/H)
FOR NEXT FOUR HOURS(RS15/H)
FOR NEXT FOUR HOURS(RS20/H)
FOR NEXT FOUR HOURS(RS25/H)

int h,c=0;
h=Integer.parseInt(jTextField1.getText().trim());
if(h<=8)
c=50;
else if(h>=8 && h<12)
c=50+10;
else if(h>=12 && h<16)

15
c=50+10+15;
else if(h>=16 && h<20)
c=50+10+15+20;
else
c=50+10+15+20+25;
jTextField2.setText(" "+c);

Q13.Write a program to calculate percentage


and grade of five subjects marks.

int a,b,c,d,e,r=0;
a=Integer.parseInt(jTextField1.getText().trim());
b=Integer.parseInt(jTextField2.getText().trim());
c=Integer.parseInt(jTextField3.getText().trim());
d=Integer.parseInt(jTextField4.getText().trim());
e=Integer.parseInt(jTextField5.getText().trim());
r=((a+b+c+d+e)*100)/500;
jTextField6.setText(" "+r);
if (r>=85)
jTextField7.setText("A");
else if (r>75 && r<85)
jTextField7.setText("B");
else if(r>65 && r<75)
jTextField7.setText("C");
else if(r>55 && r<65)

16
jTextField7.setText("D");
else
jTextField7.setText("fail");

Q14.Write a program to check whether the


entered value is a vowel or a consonant.

char a=jTextField1.getText().trim().charAt(0);
if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
jTextField2.setText("vowel");
else
jTextField2.setText("consonant");

Q15.Write a program to convert the entered


value into celcius.

17
Float t;
t=Float.parseFloat(jTextField1.getText().trim());
t=t*9/5+32;
jTextField2.setText(" "+t);

Q16.
PIZZA HUT

int q,r = 0,a = 0;


q=Integer.parseInt(jTextField2.getText().trim());
if(jRadioButton2.isSelected())
r=180;
else if(jRadioButton3.isSelected())
r=120;
jTextField3.setText(" "+r);
a = q*r;
jTextField4.setText(" "+a);

int q,r = 0,a = 0,t=0,n;


q=Integer.parseInt(jTextField2.getText().trim());
if(jCheckBox1.isSelected())
t=20;

18
else if(jCheckBox2.isSelected())
t=20;
else if(jCheckBox3.isSelected())
t=20;
jTextField5.setText(" "+t);
n=a+t;
jTextField6.setText(" "+n);

System.exit(0);

jTextField1.setText(" ");
jTextField2.setText(" ");
jTextField3.setText(" ");
jTextField4.setText(" ");
jTextField5.setText(" ");
jTextField6.setText(" ");

Q17.Write a program to calculate sum of all even


numbers between 25-55.

int i,s = 0;
for(i=26;i<=55;i++)
{
s=s+i;
}
jTextArea1.append("sum= "+s);

19
Q18.Write a program to display this pattern.

*****
****
***
**
*

int i,s = 0;
for(i=1;i<=5;i++)
{
for(s=1;s<=i;s++)
{
jTextArea1.append("*");
}
jTextArea1.append(" ");
}

Q19.Write a program to accept a number and


calculate sum of all digits in that number.

20
int n,a,s = 0;
n=Integer.parseInt(jTextField1.getText().trim());
while(n!=0)
{
a=n%10;
s=s+a;
n=n/10;
}
jTextArea1.append("sum of all digits= "+s);

Q20.Write a program to accept a number and


display its reverse order.

int n,a,s = 0;
n=Integer.parseInt(jTextField1.getText().trim());
while(n!=0)
{
a=n%10;
jTextArea1.append(""+a);
n=n/10;
}

21
SQL
(Structured Query Language)
My SQL is a free source
Relational Database
ManagementSystem
(RDMBS) that uses
Structured Query language
(SQL).In a MySQL
database, information is
stored in Tables. A Single
MySQL database can
contain many tables at once
and store thousands of
individual records.

22
My SQL Programmes

1.Create table inventory.

Q1.Display all the records.

23
Q2. Display all the Name.

Q3.Dislpay all the records where


price is Between 10 to 25.

24
Q4. Display all the records where
Name = Fresh tea and Qty=20.

Q5.Dispaly all the records where Qty


not 10.

25
2.Create table sports.

Q1.Display all the record.

26
Q2.Display the names of the students
who are getting grade ‘C’.

Q3. Display all the names starting


whit A and ends with T.

27
Q4.Dislay all the records where Grade
=A.

Q4.Add a new column SUPW


varchar(40)……

28
3. Create table Teachers.

Q1.Display all the Record.

29
Q2. To show all information about the
teacher of history department.

Q3. To list the names of female


teacher who are in Hindi department.

30
Q4. To list all the details where
Department = History and salary is
b/w 25000 to 30000…..

Q5. Display all the details where


name starts with S….

31
4. Create Table MOV.

Q1.Display all the Records.

32
Q2. Display all the movies where
price is above 20.

Q3.Dispaly all the movies sorted by


Qty in descending order.

33
Q4. Display all the records where
price B/W 45 to55.

Q5. Display all movies title whose


Rating is R.

34

You might also like