JAVA PROGRAM-2
JAVA PROGRAM-2
Simple Interest :
CALCULATE REFRESH
Swing Controls used in the GUI Application :
1. jLabel1 : 6. jTextField1 :
Properties : Properties :
Text – “Enter the Principal Amount : ” Change variable name – “T1”
Font - Bold, 20 Text – “ ”
2. jLabel2 : Font - Bold, 20
Properties : 7. jTextField1 :
Text – “Enter the Rate of Interest : ” Properties :
Font - Bold, 20 Change variable name – “T2”
3. jLabel3 : Text – “ ”
Properties : Font - Bold, 20
Text – “Enter the time period: ” 8. jTextField1 :
Font - Bold, 20 Properties :
4. jLabel4 : Change variable name – “T3”
Properties : Text – “ ”
Text – “Simple Interest: ” Font - Bold, 20
Font - Bold, 20 9. jButton1 :
5. jLabel5 : Properties :
Properties : Text – “CALCULATE”
Text – “ ” Font - Bold, 20
Font - Bold, 20 10. jButton2 :
Properties :
Text – “REFRESH”
Font - Bold, 20
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
int P, R, T;
Double SI;
P = Integer.parseInt(T1.getTest());
R = Integer.parseInt(T2.getText());
T = Integer.parseInt(T3.getText());
SI = (P*R*T)/100;
jLabel4.setText(SI);
}
}
}
} }
else if(P > 60)
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
{
jLabel3.setText(“B2”); T.setText(“ “);
}
}
else if(P > 50)
{
jLabel3.setText(“C1”);
}
else if(P > 40)
{
jLabel3.setText(“C2”);
}
Design a GUI application, to enter an alphabet and check whether it is vowel / consonant
Book Code :
Title of Book :
Author of Book :
Price of Book :
Customer Type :
Final Amount :
Swing Controls used in the GUI Application :
1. jLabel1 :
Properties : 11. jButton1 :
Text – “Book Code : ” Properties :
Font - Bold, 20 Text – “RESULT”
2. jLabel2 : Font - Bold, 20
Properties : 12. jButton2 :
Text – “Title of Book : ” Properties :
Font - Bold, 20 Text – “REFRESH”
3. jLabel3 : Font - Bold, 20
Properties : 13. jTextField1 :
Text – “Author of Book : ” Properties :
Font - Bold, 20 Text – “ ”
4. jLabel4 : Font - Bold, 20
Properties : 14. jTextField2 :
Text – “ Price of Book” Properties :
Font - Bold, 20 Text – “ ”
Font - Bold, 20
5. jLabel5 :
Properties :
Text – “ ”
Font - Bold, 20
6. jLabel6 :
Properties :
Text – “ Customer Type :”
Font - Bold, 20
7. jLabel7 :
Properties :
Text – “ Final Amount :”
Font - Bold, 20
8. jLabel8 :
Properties :
Text – “ ”
Font - Bold, 20
9. jCombobox1 :
Properties :
Change variable name – “C1”
Model – “B001”, “B002”, “B003”, “B004”
10. jCombobox2 :
Properties :
Change variable name – “C2”
Model – “Bookseller”, “School”, “Customer”
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
double A, D;
if(C1.getSelected( ) == “B001”)
{
D = 300;
jLabel5.setText(“300”);
}
else if(C1.getSelected( ) == “B002”)
{
D = 200;
jLabel5.setText(“200”); private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
}
else if((C1.getSelected( ) == “B003”)
{
{ jTextField1..setText(“ “);
D = 100; jTextField2..setText(“ “);
jLabel5.setText(“100”); jLabel5.setText(“ “);
} jLabel8.setText(“ “);
else
{
}
jLabel5.setText(“50”);
}
if(C2.getSelected( ) == “Bookseller”)
{
A = D - D*0.25;
jLabel8.setText(A);
}
else if(C2.getSelected( ) == “School”)
{
A = D - D*0.2;
jLabel8.setText(A);
}
else
{
A = D - D*0.1;
jLabel8.setText(A);
}
}
A networking company design a GUI Application to store the employee information as follow,
It accept the Employee Name, Father’s Name, Mother’s Name, Address, Gender, Basic Salary, Medical & Conveyance.
Calculate the Gross and Net salary as follow.
Basic DA HRA
>=40000 35% 37%
>=20000 25% 32%
>=10000 25% 30%
Employee Name :
Father’s Name :
Mother’s Name :
Address :
Basic Salary :
Medical Conveyance:
Gross Salary
Net Salary
REFRESH
Swing Controls used in the GUI Application : 10. jButton1 :
1. jLabel1 : Properties :
Properties : Text – “Gross Salary”
Text – “Employee Name : ” Font - Bold, 20
Font - Bold, 20 11. jButton2 :
2. jLabel2 : Properties :
Properties : Text – “Net Salary”
Font - Bold, 20
Text – “Father’s Name : ”
12. jButton3 :
Font - Bold, 20
Properties :
3. jLabel3 : Text – “REFRESH”
Properties : Font - Bold, 20
Text – “Mother’s Name: ” 13. jTextField1 :
Font - Bold, 20 Properties :
4. jLabel4 : Text – “ ”
Properties : Font - Bold, 20
Text – “ Address :” 14. jTextField2 :
Font - Bold, 20 Properties :
5. jLabel5 : Text – “ ”
Properties : Font - Bold, 20
Text – “ Gender :” 15. jTextField3 :
Font - Bold, 20 Properties :
6. jLabel6 : Text – “ ”
Properties : Font - Bold, 20
Text – “Basic Salary :” 16. jTextField4 :
Font - Bold, 20 Properties :
7. jLabel7 : Text – “ ”
Properties : Font - Bold, 20
17. jTextField5 :
Text – “ Medical Conveyance :”
Properties :
Font - Bold, 20
Text – “ ”
8. jLabel8 : Font - Bold, 20
Properties : 18. jTextField6 :
Text – “ ” Properties :
Font - Bold, 20 Text – “ ”
9. jLabel9 : Font - Bold, 20
Properties : 19. jRadioButton1 :
Text – “ ” Properties :
Font - Bold, 20 Text – “Male”
20. jRadioButton1 :
Properties :
Text – “Female”
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
double BS, GS, NS;
BS = Double.parseDouble(jTextField5.getText( ));
if(BS >= 40000)
{
GS = BS + BS*0.35;
NS = BS + BS*0.35 + BS*0.37;
jLabel8.setText(GS);
jLabel9.setText(NS);
}
else if(BS >= 20000) private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
GS = BS + BS*0.25;
{
NS = BS + BS*0.25 + BS*0.32; jTextField1..setText(“ “);
jLabel8.setText(GS); jTextField2..setText(“ “);
jLabel9.setText(NS); jTextField3..setText(“ “);
} jTextField4..setText(“ “);
else if((BS >= 10000)
{
jTextField5..setText(“ “);
GS = BS + BS*0.25; jTextField6..setText(“ “);
NS = BS + BS*0.25 + BS*0.30; jLabel8.setText(“ “);
jLabel8.setText(GS); jLabel9.setText(“ “);
jLabel9.setText(NS); }
}
else
{
jLabel8.setText(GS);
jLabel9.setText(NS);
}
}
Design a GUI application, to enter a three digit number and find the sum of all the digits.