Académique Documents
Professionnel Documents
Culture Documents
Informati
cs
Practices
Practical File
[ANUPAM VERMA]
XII-H
42
INDEX
1. Create a Java application to find the discount of an
item on the basis of category of item
2. Create a Java application to find the incentive ( %)
of sales for a sales person
3. Create a java applications to convert a given
temperature Fahrenheit to celcius and vice versa
using switch case statement
4. Create a java desktop application to store
nationality of peoples in a jcombobox control
5. Write a Java Desktop application to swap two
number without using third variable
6. Write a Java Desktop application that take a
number of seconds as input and converts this
value to the corresponding number of hours,
minutes, and seconds.
7. Write a program that reads an integer value and
print the sum of all even integers between 2 and
the input value inclusive. Print an error message if
the input value is less than 2
8. Write a program to check weather the number is
prime or not.
9. Write a program to check weather the number is
perfect or not.
42
NAME :
EMAIL :
SIGN ME UP !
Special
Shop Notes:
timing : 10.00 a.m to 8.00 p.m
CERTIFICATE
Sign……………….
Date………………
42
Answer:
private void
jButton1ActionPerformed(java.awt.event.ActionEventev
t) {
String s1=tf1.getText():;
Int num= Integer.parseInt(s1);
float doc;
float dot=0;
if (num1<=1000)
{doc=(5/100)*num1;}
else
{doc=(10/100)*num1;}
If(rb1.isSelected())
{dot=(3/100)*num1;}
If(rb2.isSelected())
{dot=(2/100)*num1;}
If(rb3.isSelected())
{dot=(1/100)*num1;}
}
Float td=(doc+dot);
Tf2.setText(“discount is”+td);
}
42
OUTPUT:-
42
Answer:
private void
jButton1ActionPerformed(java.awt.event.ActionEventev
t) {
String s1=TF1.getText();
Float num=Float.parseFloat(s1);
Float ms=0, ecf=0, mcc=0;
if(CB1.isSelected())
{ms=(10/100)*num;
}
if(CB2.isSelected())
{ecf=(8/100)*num;
}
if(CB3.isSelected())
{mcc=(5/100)*num;
}
float tic=ms+ecf+mcc;
TF2.setText("" + tic);
}
42
OUTPUT:-
42
temprature
Fahrenheit to Celsius convert
Celsius to Fahrenheit
Exit
Converted value
Answer:
private void
jButton1ActionPerformed(java.awt.event.ActionEventev
t) {
float t=Float.parseFloat(Temp.getText());
doubleval;
intch;
if(FC.isSelected())
ch=1;
42
else
ch=2;
switch(ch) {
case 1:val=(t-32)*5/9;
value.setText("value is"+val);break;
case 2:val=(1.8*t)+32;
value.setText("value is"+val);break;
}
OUTPUT:-
42
Nationality
Sri Lanka
dispaly Exit
Answer:
private void
jButton1ActionPerformed(java.awt.event.ActionEventev
t) {
String nat=(String)Nation.getSelectedItem();
String str="Your nationality is "+nat;
JOptionPane.showMessageDialog(null,str);
}
OUTPUT:-
42
42
OUTPUT:-
42
Answer:
private void
jButton1ActionPerformed(java.awt.event.ActionEventev
t) {
int sum=0;
int a=Integer.parseInt(num.getText());
if(a>2)
{for(int i=3;i<=a;i++)
{if(i%2==0)
sum=sum+i;
}res.setText(""+sum);}
else
{JOptionPane.showMessageDialog(null,"Wrong
Input");}
}
OUTPUT:-
42
42
OUTPUT:-
42
private void
jButton2ActionPerformed(java.awt.event.ActionEve
ntevt) {
String a=t1.getText();
DefaultListModeldlm=(DefaultListModel)lst.getMod
el();
int b=lst.getSelectedIndex();
dlm.removeElementAt(b);
lst.setModel(dlm);
}
42
OUTPUT:-
42
OUTPUT:-
42
OUTPUT:-
Answer:
The names will get into a form of a list.
OUTPUT:-
42
Answer:
The above link is named intro and this hyperlink is
linked to a heading within the document the name of
the heading is also intro.
42
OUTPUT:-
42
OUTPUT:-
42
Answer:
<HTML>
<BODY>
<H1 align="center">HTML FORM EXAMPLE</H1>
<BR>
<FORM action="mailto:abc.xyz@gmail.com"
method="post">
NAME: <INPUT type="text" name="name"/><BR>
<BR>
EMAIL: <INPUT type="text" name="email"/>
<BR><BR><BR>
<INPUT type="submit" value="Sign Me Up!"/>
</FORM>
</BODY>
</HTML>
42
OUTPUT:-
42
Special Notes:
a) Title of the page is APKA BAZAR.
b) Backgound color of the page is grey and
font style is COMIC SANSMS.
c)The font of the subtitle “All yours……roof”
is TAHOMA in maroon colour.
d) Link color should be BLUE and the visiting
link color be GREEN.
e) The page are linked as followes:
Clothing & Accessories as
clothes.htm
Household Appliances as
house.htm
Grocery as grocery.htm
f) Use ordered land unordered list wherever
required.
42
<LI><A HREF="house.htm">Household
Appliances</A>
<LI><A HREF="grocery.htm">Grocery</A>
</OL><BR>
<HR size=5>
<H6>Shop timings:10 am to 8 pm
</H6>
<HR size=5>
</FONT>
</BODY>
</HTML>
OUTPUT:-
42