CASE STUDY 1:
TO CONVERT TEMPERATURE INTO CECCIUS08
FAHRENHEIT
Temperature Coversion
ENter Temperature 5 @ Fahrenheit to celcius
Result -15.0
O celcius to fahrenheit
Convert
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
float c,f;
if(jRadioButton1.isSeIected())
f=Float.parseFloat(jTextFieId1.getText());
jTextField2.setText(" "+c);
else
c=Float.parseFloat(jTextField1.getText());
f-9/5%+32;
jTextField2.setText(" "+f),
CASE STUDY 2:
Write lava application that input number &
find
-number ofdgvs in that month
-table of input number
-first 10 even numbers
enter month number 11
Be?$ageh
(i) 30 days
number of days OK
show even
table
private void jButton1ActionPerformed(java.awt.event.ActionEvent
int n=lnteger.parselnt(t1.getText());
for(int
ta.append("
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
int mno=Integer.parselnt(t1.getText());
switch(mno)
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
days");
break;
case 2:
JOptionPane.showMessageDialog(nuIl,"28or 29 days");
break;
case 4:
case 6:
case 9:
case 11:
J OptionPane.showMessageDialog(nuIl,"30
days");
default:
System.out.print("not month number");
CASE STUDY 3:
CglculqteSimpleInterest god amount to be
paid
t- Jt0JtexJ
entel jncqtal 2000
rate
intlest
• 5 year
10
15 year
calculate clear exit
private void jButton3ActionPerfor ed(java.awt.event.ActionEvent
int p=lnteger.parselnt(tl.ge ext());
int r=Integer.parseInt(t2. etText());
int t=O;
float i;
if(r1.isSeIected())
else if(r2.isSeIected())
t=10;
else
t-15;
t3.setText(" "+1);
private void
jButton2ActionPerformed(java.awt.event. ctionEvent evt) {
t1.setText(
t2.setText(
t3.setText(
rl.setSelected(true);
private void
jButton1ActionPerformed(ja ,awt,event.ActionEvent evt) {
System.exit(O);
CASE STUDY 4:
Wre Jav A i aeo to i
student in 5 subject and calculate Total.
percentgqe . Grade ( then Pgss
Otherwise fail)
Minimize
roll no
[55
bst 44
acc 44
eco 33
total
calculate
per 50
grade pass
clear
private void jButton1ActionPerformed(java.awt.event.ActionEvent
int eng=Integer.parseInt(t2.getText());
int acc=lnteger.parselnt(t3.getText());
int ip=Integer.parselnt(t4.getText());
int bst=lnteger.parseInt(t5.getText());
int eco=Integer.parseInt(t6.getText());
int total=eng+acc+ip+bst+eco;
int p=total/5;
t7.setTextC'"+total);
t8.setText('"'+p);
if (p>=33)
t9.setText("Pass");
else
t9.setText("fail");
CASE STUDY 5:
Write Jqvq Application to chang the cplpr pn Iqble -text.
and button Selected from the Listcontrol
red
green jLabe11
blue
agentaj jButtoni
eri ie
Y' appty•on lable apply on button
@ apply on text field
private void IlVaIueChanged(javax.swing.event.ListSeIectionEvent
int i;
Color x=Color.WHlTE;
i=11.getSeIectedIndex();
switch(i)
CASE STUDY 5:
Write Jqvg Application to chqnq the cplpr pn lg&le.text.
and button Selected from the List control
red
green jLabe11
blue
'nagenta jButton1
Cie
v' appty on lable appry on button
@ appt}/on text field
private void llVaIueChanged(javax.swing.event.ListSeIectionEvent
int i;
Color x=Color.WHlTE;
i=11.getSelectedIndex();
switch(i)
case O:
x=Color.RED;
break;
case 1:
x=Color.GREEN;
break;
case 2:
x=Color.BLUE;
break;
case 3:
x=Color.MAGENTA;
break;
if(c1.isSeIected())
labl.setBackground(
else
labl.setBackgroun (Color.WHIT
if(c2.isSeIected())
butl.setBackground(x);
else
butl.setBackground(CoIor.WHITE);
if(c3.isSeIected())
tf.setBackground(x);
else
tf.setBackground(Color.WHlTE);
CASE STUDY 6:
Write an application in lava to calculate
Amount 30000 TV
C,Music System
Discount 3000
Calculate
Net 27000
discount
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
int d=O,net=O;
int amt=Integer.parseInt(jTextField1.getText());
if(jRadioButton1.isSeIected())
eise
else if(amt>50000)
d=amt*15/100;
else if(jRadioButton2.isSeIected())
d=amt*10/100;
else if(amt<=50000)
d=amt*20/100;
else if(amt>50000)
net=amt-d;
jTextField2.setText(" '
jTextField3.setText("
CASE STUDY 7:
Calculate offer,Additional offer& net
amount
Name
BanAmount '30000
Platinum Gold Sliver
Otter 6000 0
Additional Otter 1500 0
Net Amount
I Calculate otter Calculate Net Exit
public class platinum extends javax.swing.JFrame {
/ ** Creates new form pla num */
public platinum() {
initComponents();
tf3.setText("O");
tf4.setText("O");
tf5.setText("O");
tf3.setEditable(false);
tf4.setEditable(false);
tf5.setEditabIe(false);
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
double b,of,ao;
b=DoubIe.parseDoubIe(tf2.getText());
if(jRadioButton1.isSeIected())
else if(jRadioButton2.isSeIected())
else
ao-b*5/100;
else
ao=O.O•,
tf3.setText(" '
tf4.setText(" ''Jrao);
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
double b,o,ao,na;
b=Double.parseDouble(tf2.getText());
0=Double.parseDouble(tf3.getText());
ao=Double.parseDouble(tf4.getText());
na=b+o+ao;
tf5.setText(" "+na);
private void
jButton3ActionPerformed(java.awt.event.Acti nEvent evt) {
System.exit(O);
CASE STUDY 8: SUM OF N
NUMBERS>>>>>
SUM OF N ODD NUMB
OF N ODD NUMBERS
ENter N 5
Sum of n odd no: 25
Find sum
private void jButton1ActionPerformed(java.awt.event.ActionEvent
int n=lnteger.parselnt(jTextField1.getText());
int sum=O;
for(int i=1;i<=n*2;i=i+2)
sum=sum+i;
jTextFieId2.setText(" "+sum);
CASE STUDY 9
Design g cg/cu/gtor
First Nutnber
Second Nurnber
Result
Reset Stop
private void jButton1ActionPerformed(java.awt.event.ActionEvent
int n1=Integer.parseInt(jTextField1.getText());
int n2=lnteger.parseInt(jTextFieId2.getText());
int r=n1+n2;
jTextFieId3.setText(" "+r);
private void
evt) {
int n1=lnteger.parselnt(JTextField1.getText()
int n2=Integer.parselnt(jTextField2.getTe ());
int r=n1-n2;
jTextField3.setText(" "+r);
private void
jButton3ActionPerformed(jav .awt.event.ActionEvent evt) {
int nl=lnteger.parseln jTextFieId1.getText());
int n2=Integer.pars nt(jTextField2.getText());
int r=n1*n2;
jTextFieId3.setText(' "+r);
private void
jButton4Action erformed(java.awt.event.ActionEvent evt) {
int nl=ln eger.parseInt(jTextField1.getText());
int n2=I teger.parseInt(jTextFieId2.getText());
int 1/n2;
jTextFieId3.setText(" "+r);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText(
JTextField2.setText(
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(O);
CASE STUDY 10:
Write a code in lava to find name of day through
radioButton
WEEK DAY
Day Day Two Day Three
Day FOCIr Day Five Day Six
Day Seven
Q.aesciay
CLICK HERE TO vxevv WEEKDAY
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
if(jRadioButton1,isSelected())
jTextField1.setText("Sunday");
else if(jRadioButton2.isSelected())
jTextField1.setText("Monday");
else if(jRadioButton3.isSeIected())
jTextField1.setText("tuesday");
else if(jRadioButton4.isSeIected())
jTextField1.setText("Wednesday");
else if(jRadioButton5.isSelected())
jTextField1.setText("Thrusday" ,
else if(jRadioButton6.isSeIecte ))
else if(jRadioButton7.isSele ted())
jTextField1.setText("Sa rday");
else
jTextField1.setText(" valid ");
CASE STUDY 11:
WRITE A COPE IN FOR LOGIN PASSWORD FORM
private void jButton1ActionPerformed(java.awteevent.ActionEvent
evt) {
String pwd=new String(jPasswordFieId1.getPassword());
if(pwd.equals("mynameiskhan"))
JOptionPane.showMessageDialog(null,"YOU HAVE LOGGED IN
SUCCESSFULLY");
else
'INCORRECT USERID
OR PASSWORD");
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(O);
LOGINcooe
User Name Muskan
Password
check
Message
Incorrect Password Try Again.
OK
CASE STUDY 12:
Write a code in lava to find Find Factorial
Find Factorial
Enter NO 5
factorialof 5 =120
Find Factorial
int no=lnteger.parselnt(jTextField1.getText());
intf=l;
int i=no;
while(i>=l)
i--;
jTextArea1.append("factorialof
CASE STUDY 13:
Write lava Applicationto insert record in student table.
roll no
natue
mavks
add record
Record added Successf IV
OK
private void jButton1ActionPerformed(java.a sevent.ActionEventevt) {
try {
Class.forName("java.sql.Driver");
Connection con=DriverManager.getC nnection("jdbc:mysql://localhost/student","root,
Statement stmt=con.createState ent();
String q="lnsert into stud
JOptionPane.showMessageDialog(null,q);
stmt.executeUpdate(q);
JOptionPane.showMessageDialog(null,"Record added Successfully");
stmt.close();
con.close();
catch(Exception e)
CASE STUDY 14:
Write •avaA lication to DELETE reco d in student table.
roll no
name
marks
delete
_SetectanOption
want to delete
roll no
name tlala
marks
delete find
Message
record deleted
OK
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/student","root 1'll
Statement stmt-con.createStatement();
int
String q="Select * from stud where rno="+rno+ ,
ResultSet rs=stmt.executeQuery(q);
if(rs.next())
String name=rs.getString("name");
JOptionPane.showMessageDialog(null,name);
int marks= rs.getlnt("marks");
t2.setText(name);
t3.setText(""+marks);
int res=JOptionPane.showConfirmDialog(null,"wantto delete");
stmt=con.createStatement();
String query="delete from stud where rno="+rno+ ,
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"record deleted");
else
JOptionPaneshowMessageDialog(null,"no record");
catch(Exception e) {
JOptionPane.showMessageDialog(null,"error");
x x x