Powered By Blogger

Tuesday 3 November 2015

IP PRACTICAL LIST FOR Std-XII


By-RJ SHUKLA




PRACTICAL NO 1
Write a java program to check whether the given number is multiple of 3,multiple of 5 ormultiple ofCOMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
ENTER NUMBER
TextField
jTextField1
getText()
RadioButton
jRadioButton1
MULTIPLE OF 3
RadioButton
jRadioButton2
MULTIPLE OF 5
RadioButton
jRadioButton3
MULTIPLE OF 7
Code on jRadioButton1
doublenum =Double.parseDouble(jTextField1.getText());
if(num %3==0)                                                                
        {
JOptionPane.showMessageDialog(this,"This number is a multiple of 3");
        }
else
        {
JOptionPane.showMessageDialog(this,"This number is not a multiple of 3");
        }
Code on jRadioButton2
doublenum =Double.parseDouble(jTextField1.getText());
if(num %5==0)
        {
JOptionPane.showMessageDialog(this,"This number is a multiple of 5");
        }
else
        {
JOptionPane.showMessageDialog(this,"This number is not a multiple of 5");
        }
Code on jRadioButton3
doublenum =Double.parseDouble(jTextField1.getText());
if(num %7==0)
        {
JOptionPane.showMessageDialog(this,"This number is a multiple of 7");
        }
else
        {
JOptionPane.showMessageDialog(this,"This number is not a multiple of 7");
        }















PRACTICAL NO 2
Write a java program for creating business calculator
3.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
COST PRICE
Label
JLabel2
PROFIT MARGIN
Label
JLabel3
SELLING PRICE
TextField
jTextField1
getText()
TextField
jTextField2
setText()
ComboBox
jComboBox1
5 PERCENT
10 PERCENT
15 PERCENT
20 PERCENT
25 PERCENT
Button
jButton1
CALCULATE
Code on jButton1
doublecp,sp,profit=0;
int p;
cp=Double.parseDouble(jTextField1.getText());
    p=jComboBox1.getSelectedIndex();
switch (p)
    {
case 0: profit=5;
break;
case 1: profit=10;
break;
case 2: profit=15;
break;
case 3: profit=20;
break;
case 4: profit=25;
break;
default:profit=0;
break;
    }
sp=(cp+cp)*(profit/100);
jTextField2.setText(Double.toString(sp));















PRACTICAL NO 3
Write a java program for calculating sum of series of number
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
STARTING NUMBER
Label
JLabel2
STEPS
Label
JLabel3
NO OF TERMS
Label
JLabel4
SUM OF SERIES
TextField
jTextField1
getText()
TextField
jTextField2
getText
TextField
jTextField3
setText()
ComboBox
jComboBox1
1
2
3
4
5
Button
jButton1
CALCULATE
Button
JButton2
RESET


Code on jButton1
intstart,step,terms,sum=0;
start=Integer.parseInt(jTextField1.getText());
step=jComboBox1.getSelectedIndex()+1;
terms=Integer.parseInt(jTextField2.getText());
for(inti=1;i<=terms;i++)
        {
sum=sum+start;
start=start+step;
        }
jTextField3.setText(Integer.toString(sum));

Code on jButton2
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jComboBox1.setSelectedIndex(-1);














PRACTICAL NO 4
Write a java program to find the sum of the digits
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
ENTER NUMBER
Label
jLabel2
SUM OF DIGIT
TextField
jTextField1
getText()
TextField
JTextField2
setText()
Button
jButton1
CALCULATE
Code on jButton1
intx,a=0,sum=0;
x=Integer.parseInt(jTextField1.getText());
while(x>0)
{
a=x%10;
x=x/10;
sum=sum+a;
}
jTextField2.setText(Integer.toString(sum));






PRACTICAL NO 5
Write a java program to find whether the number is palindrome or not
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
ENTER NUMBER
Label
jLabel2
REVERSED NUMBER
TextField
jTextField1
getText()
TextField
JTextField2
setText()
Button
jButton1
CHECK
Code on jButton1
longnumber,temp,revno=0;
number = Long.parseLong(jTextField1.getText());
temp=number;
while(temp >0)
{
revno=(revno*10)+(temp %10);
temp=temp/10;
        }
jTextField2.setText(Long.toString(revno));
if(number==revno)
        {
JOptionPane.showMessageDialog(null,"Number is palindrome");
        }
else
        {
JOptionPane.showMessageDialog(null,"Number is not a palindrome");
        }































PRACTICAL NO 6
Write a java program to print the multiplication table of the given number
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
ENTER NUMBER
TextField
jTextField1
getText()
TextArea
jTextArea1
setText()
Button
jButton1
CLICK
Code on jButton1
intnum;
num=Integer.parseInt(jTextField1.getText());
for(inti=0;i<=10;i++)
        {
int T = num*i;
jTextArea1.setText(jTextArea1.getText()+Integer.toString(num+" * "+i+" = "+T+"\n"));
        }








PRACTICAL NO 7
Write a java program to accept cost price and selling price and calculate the profit or loss
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
ENTER COST PRICE
Label
jLabel2
ENTER SELLING PRICE
TextField
jTextField1
getText()
TextField
JTextField2
getText()
Button
jButton1
CHECK
Code on jButton1
int CP,SP;
CP=Integer.parseInt(jTextField1.getText());
SP=Integer.parseInt(jTextField2.getText());
if(CP>SP)
        {
JOptionPane.showMessageDialog(null,"PROFIT");
        }
else
        {
JOptionPane.showMessageDialog(null,"LOSS");
        }





PRACTICAL NO 8
Write a java program to convert kilogram to gram, liters to milliliters and meter to centimeter
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
ENTER NUMBER
Label
jLabel2
RESULT
TextField
jTextField1
getText()
TextField
JTextField2
setText()
Button
jButton1
GRAM TO KILOGRAM
Button
jButton2
LITERS TO MILLILITERS
Button
jButton3
METER TO CENTIMETER
Code on jButton1
intgm,kg;
gm=Integer.parseInt(jTextField1.getText());
kg=gm*1000;
jTextField2.setText(Integer .toString(kg));

Code on jButton2
intl,ml;
l=Integer.parseInt(jTextField1.getText());
ml=l*1000;
jTextField2.setText(Integer.toString(ml));

Code on jButton3
intm,cm;
m=Integer.parseInt(jTextField1.getText());
cm=m*100;
jTextField2.setText(Integer.toString(cm));
PRACTICAL NO 9
Write a java program to find the factorial of the number
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
ENTER NUMBER
Label
jLabel2
RESULT
TextField
jTextField1
getText()
TextField
JTextField2
setText()
Button
jButton1
FIND
Code on jButton1
intn,c,fact=1;
       n=Integer.parseInt(jTextField1.getText());
if(n<0)
        {
JOptionPane.showMessageDialog(null,"ENTER A VALID NUMBER");
        }
else
        {
for(c=1;c<=n;c++)
            {
fact = fact * c;
jTextField2.setText(Integer.toString(fact));
            }
        }



PRACTICAL NO 10
Write a java program to calculate the salary of the employee according to the given condition
Basic
DA
HRA
>=40000
35%
37%
>=20000
25%
32%
>=10000
25%
30%
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
Employee Name
Label
jLabel2
Basic Salary
Label
JLabel3
DA
Label
JLabel4
HRA
Label
JLabel5
Total Salary
TextField
jTextField1
getText()
TextField
JTextField2
getText()
TextField
JTextField3
getText()
TextField
JTextField4
getText()
TextField
JTextField5
setText()
Button
jButton1
CALCULATE


Code on jButton1
floatesal,da=0,hra=0,total;
esal = Float.parseFloat(jTextField2.getText());
if(esal> 40000)
          {
da = esal * 35/100;
hra = esal * 37/100;
          }
          else
if(esal>= 20000)
            {
da = esal * 25/100;
          hra = esal * 32/100;
            }
else
if(esal>= 10000)
          {
da = esal * 25/100;
          hra = esal * 30/100;
          }
total=esal+da+hra;
jTextField3.setText(Float.toString(da));
jTextField4.setText(Float.toString(hra));
jTextField5.setText(Float.toString(total));










PRACTICAL NO 11
Write a java program to calculate the income tax on the basis of given conditions
INCOME UPTO 1 LAKH
NIL
1 LAKH TO 1.5 LAKH
10% OF INCOME
1.5 LAKH TO 2.5 LAKH
20% OF INCOME
2.5 LAKH AND ABOVE
30% OF INCOME
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
Employee code
Label
jLabel2
Name
Label
JLabel3
Enter income
Label
JLabel4
Income tax
TextField
jTextField1
getText()
TextField
JTextField2
getText()
TextField
JTextField3
getText()
TextField
JTextField4
setText()
Button
jButton1
CALCULATE
Code on jButton1
float income = Float.parseFloat(jTextField3.getText());
floatITax = 0;
if (income < 100000)
ITax = 0;
else
if (income>=100001 && income<=150000)
            {
ITax = income * 10/100;
            }
else
if (income>=150001 && income<=250000)
            {
ITax = income * 20/100;
            }
else
if (income>=250001)
            {
ITax = income * 30/100;
            }
jTextField4.setText(String.valueOf(ITax));



















PRACTICAL NO 12
Write a java program to calculate the percentage and grade on the basis of given condition
4.PNG
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
FIRST TERM MARKS
Label
jLabel2
SECOND TERM MARKS
TextField
jTextField1
getText()
TextField
JTextField2
getText()
TextField
JTextField3
setText()
TextField
JTextField4
setText()
CheckBox
jCheckBox1
NCC
RadioButton
jRadioButton1
MEDICAL
RadioButton
jRadioButton2
NON MEDICAL
Button
jButton1
PERCENTAGE
Button
jButton2
GRADE
Code on jButton1
intfterm,sterm,total=0;
float per=0;
fterm=Integer.parseInt(jTextField1.getText());
sterm=Integer.parseInt(jTextField2.getText());
per=(fterm+sterm)/2;
if(jCheckBox1.isSelected())
        {
per = per + 3;
if(per>100)
            {
per=100;
            }
        }
else
       {
per=per;
       }
jTextField3.setText(Float.toString(per));

Code on jButton2
Float per=Float.parseFloat(jTextField3.getText());
        String gra=null;
if(jRadioButton1.isSelected())
        {
if(per>=80)
            {
gra="A";
            }
if (per >= 60 && per<=79)
            {
gra = "B";
            }
if (per <60)
            {
gra = "C";
            }
        }
if(jRadioButton2.isSelected())
        {
if(per>=75)
            {
gra="A";
            }
if (per >= 50 && per<=74)
            {
gra = "B";
            }
if (per <50)
            {
gra = "C";
            }
        }
jTextField4.setText(gra);























PRACTICAL NO 13
Axis Bank wants to calculate the SI of their clients
The following table shows the details of SI
TIME
RATE OF INTEREST
2 YEARS
7%
3 YEARS
8%
5 YEARS
10%
COMPONENTS
CONTROL
NAME
TYPE
Label
jLabel1
PRINCIPLE
Label
JLabel2
RATE
Label
JLabel3
SIMPLE INTEREST
TextField
jTextField1
getText()
TextField
JTextField2
getText()
TextField
JTextField3
setText()
RadioButton
jRadioButton1
2 YEARS
RadioButton
jRadioButton2
3 YEARS
RadioButton
jRadioButton3
5 YEARS
Button
jButton1
CALCULATE
Button
jButton2
RESET
Code on jButton1
double p ,r ,t ,s=0;
p=Double.parseDouble(jTextField1.getText());
r=Double.parseDouble(jTextField2.getText());
if(jRadioButton1.isSelected())
        {
t=2;
            s=(p*r*t)/100;
        }
else
if(jRadioButton2.isSelected())
      {
t=3;
s=(p*r*t)/100;
      }
else
if(jRadioButton3.isSelected())
{
t=5;
s=(p*r*t)/100;
}
jTextField3.setText(Double.toString(s));


No comments:

Post a Comment