Anda di halaman 1dari 15

Double click on Clear button which will generate a procedure called

cmdClearActionPerformed and write the following lines as given


below:txtName.setText("");
txtDays.setText("");
txtRate.setText("");
txtFacility.setText("");
txtAmount.setText("");
OptSingle.setSelected(false);
OptDouble.setSelected(false);
OptDelux.setSelected(false);
chkTour.setSelected(false);
chkGym.setSelected(false);
chkLaundry.setSelected(false);
private void formWindowGainedFocus(java.awt.event.WindowEvent
evt){
txtRate.enable(false);
txtAmount.enable(false);

txtFacility.enable(false);
}
Double click on Calculate Rate button which will generate a
procedure called cmdRateActionPerformed and write the
following lines as given below:if (OptSingle.isSelected())
txtRate.setText(Integer.toString(1500));
else
if (OptDouble.isSelected())
txtRate.setText(Integer.toString(2800));
else
if (OptDelux.isSelected())
txtRate.setText(Integer.toString(5000));
Double click on Calculate Amount button which will generate a
procedure called
cmdAmountActionPerformed and write the
following lines as given below:if (chkTour.isSelected())
txtFacility.setText(Integer.toString(7000));
else
if (chkGym.isSelected())
txtFacility.setText(Integer.toString(2000));
else
if (chkLaundry.isSelected())
txtFacility.setText(Integer.toString(1000));
Double TAmount = (Double.parseDouble(txtRate.getText()) *
Double.parseDouble(txtDays.getText())) +
Double.parseDouble(txtFacility.getText());
txtAmount.setText(Double.toString(TAmount));
Double click on Exit button which will generate a procedure called
cmdExitActionPerformed and write the following lines as given
below:System.exit(0);

Double click on Clear button which will generate a procedure called


cmdClearActionPerformed and write the following lines as given
below:txtName.setText("");
txtQty.setText("");
txtRate.setText("");
txtTop.setText("");
txtAmount.setText("");
optRegular.setSelected(true);
chkCheese.setSelected(true);
chkCap.setSelected(false);
chkPep.setSelected(false);
Double click on Calculate Rate button which will generate a
procedure called cmdRateActionPerformed and write the
following lines as given below:if (optRegular.isSelected())
txtRate.setText(String.valueOf(220));

else
if (optPan.isSelected())
txtRate.setText(String.valueOf(260));
Double click on Calculate Amount button which will generate a
procedure called
cmdAmountActionPerformed and write the
following lines as given below:int Top = 0;
float Amt = 0;
if (chkCheese.isSelected())
{
Top = 40;
}
if (chkCap.isSelected())
{
Top = Top + 20;
}
if (chkPep.isSelected())
{
Top = Top + 25;
}
txtTop.setText(Integer.toString(Top));
Amt = (Integer.parseInt(txtRate.getText()) + Top) *
Integer.parseInt(txtQty.getText());
txtAmount.setText(Float.toString(Amt));
Double click on Exit button which will generate a procedure called
cmdExitActionPerformed and write the following lines as given
below:System.exit(0);

public class IciciUI extends javax.swing.JFrame {


public IciciUI() {
private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {
txtInterest.enable(false);
txtAmount.enable(false);
txtRate.enable(false);
}
private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {
txtPrincipal.setText("");
txtTime.setText("");
txtRate.setText("");
txtInterest.setText("");
txtAmount.setText("");
txtDate.setText("");
optFD.setSelected(true);
optRD.setSelected(false);
}
private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);

}
private void txtPrincipalActionPerformed(java.awt.event.ActionEvent evt) {
}
private void cmdCalculateActionPerformed(java.awt.event.ActionEvent evt) {
int T = Integer.parseInt(txtTime.getText());
double CI = 0, Amount =0;
double P = Double.parseDouble(txtPrincipal.getText());
float R = 0;
if (optFD.isSelected())
{
if (T<=1)
R = 10;
else
if ((T>1) && (T<=5))
R = 12;
else
if (T>5)
R = 15;
}
else
if (optRD.isSelected())
{
if (T<=2)
R = 10;
else
if ((T>2) && (T<=7))
R = 12;
else
if (T>7)
R = 15;
}
if (chkSR.isSelected())
R = R + 2;
txtRate.setText(Float.toString(R));
CI = P * Math.pow((1 + (R/100)), T);
Amount = P + CI;
txtInterest.setText(String.valueOf(CI));
txtAmount.setText(String.valueOf(Amount));
}

public class ShopUI extends javax.swing.JFrame {


public ShopUI() {
initComponents();
}
private void cmdDiscActionPerformed(java.awt.event.ActionEvent
evt) {
double discount=0;
double netamount=0;
double Amount = Double.parseDouble(txtAmount.getText());
if (optHDFC.isSelected())
discount = Amount * 12/100;
else
if (optICICI.isSelected())
discount = Amount * 10/100;
else

if (optVisa.isSelected())
discount = Amount * 9.5/100;
else
if (optAxis.isSelected())
discount = Amount * 10.5/100;
else
if (optSC.isSelected())
discount = Amount * 8.5/100;
else
if (optCity.isSelected())
discount = Amount * 11.5/100;
else
if (optSBI.isSelected())
discount = Amount * 8/100;
netamount = Amount - discount;
txtDisc.setText(String.valueOf(discount));
txtNet.setText(String.valueOf(netamount));
}
private void cmdExitActionPerformed(java.awt.event.ActionEvent
evt) {
System.exit(0);
}
private void cmdClearActionPerformed(java.awt.event.ActionEvent
evt) {
txtAmount.setText("");
txtDisc.setText("");
txtNet.setText("");
optSBI.setSelected(true);
}

public class HInhtUI extends javax.swing.JFrame {


public HInhtUI() {
initComponents();
}
class Address
{
private int ecno;
private String name;
private String address;
private String city;
private String state;
void input_data(int a, String b, String c, String d, String e)
{
ecno = a;
name = b;
address = c;
city = d;
state = e;
}
public void print_data()

{
txtArea.append("Code/No -> " + ecno + "\n");
txtArea.append("Name -> " + name + "\n");
txtArea.append("Address -> " + address + "\n");
txtArea.append("City -> " + city + "\n");
txtArea.append("State -> " + state + "\n");
}
}
class Employee extends Address
{
double salary, da, hra, gross;
Employee (double sal)
{
salary = sal;
}
void cal_salary()
{
da = 1.2 * salary;
hra = 0.15 * salary;
gross = salary + hra + da;
txtArea.append("Salary -> " + salary + "\n");
txtArea.append("DA -> " + da + "\n");
txtArea.append("HRA -> " + hra + "\n");
txtArea.append("Gross -> " + gross + "\n");
txtNet.setText(String.valueOf(gross));
}
}
class Customer extends Address
{
private int
acc_no;
private double balance;
Customer(double val)
{
balance = val;
}
void calc_int()
{
txtArea.append("Balance Amount -> " + balance + "\n");
balance = balance + (balance * 10/100);
txtArea.append("Total Balance Amount -> " + balance + "\n");
txtNet.setText(String.valueOf(balance));
}
}
private void cmdCalcActionPerformed(java.awt.event.ActionEvent evt) {
int no;
String name, address, city, state;
no = Integer.parseInt(txtNo.getText());

name = txtName.getText();
address = txtAdd.getText();
city = txtCity.getText();
state = txtSt.getText();
if (optEmp.isSelected())
{
double sal = Double.parseDouble(txtAmt.getText());
Employee emp = new Employee(sal);
emp.input_data(no, name, address, city, state);
emp.print_data();
emp.cal_salary();
}
if (optCust.isSelected())
{
double bal = Double.parseDouble(txtAmt.getText());
Customer cust = new Customer(bal);
cust.print_data();
cust.calc_int();
}
}
private void optEmpActionPerformed(java.awt.event.ActionEvent evt) {
jLabel6.setText("Salary");
jLabel7.setText("Gross");
txtNet.enable(false);
}
private void optCustActionPerformed(java.awt.event.ActionEvent evt) {
jLabel6.setText("Balance");
jLabel7.setText("Total Balance");
txtNet.enable(false);
}
private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

public class BatUI extends javax.swing.JFrame {


public BatUI() {
initComponents();
}
class Batsman
{
int bcode;
String bname;
int innings, notout, runs;
float batavg;
float calcavg()
{
return (runs/(innings-notout));
}
void readdata()
{
bcode = Integer.parseInt(txtCode.getText());
bname = txtName.getText();
innings = Integer.parseInt(txtIn.getText());
notout = Integer.parseInt(txtNot.getText());
runs = Integer.parseInt(txtRuns.getText());
batavg = calcavg();
}
void displaydata()
{

txtAvg.setText(Float.toString(batavg));
}
}
private void btnAvgActionPerformed(java.awt.event.ActionEvent
evt) {
Batsman BT = new Batsman();
BT.readdata();
BT.displaydata();
}
private void btnExitActionPerformed(java.awt.event.ActionEvent evt)
{
System.exit(0);
}

public class MealUI extends javax.swing.JFrame {


public MealUI() {
initComponents();
}
private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {
txtCarbo.setText("");
txtFat.setText("");
txtPro.setText("");
txtCal.setText("");
}
private void cmdCompActionPerformed(java.awt.event.ActionEvent evt) {
float Carbo, Fat, Prot;
float Tcal = 0;
Carbo=Integer.parseInt(txtCarbo.getText());
Fat=Integer.parseInt(txtFat.getText());
Prot=Integer.parseInt(txtPro.getText());
Tcal=(Carbo/4)+(Fat/9)+(Prot/4);
txtCal.setText(Float.toString(Tcal));
}
private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

public class MTicketUI extends javax.swing.JFrame {


public MTicketUI() {
initComponents();
}
private void btnCalcActionPerformed(java.awt.event.ActionEvent
evt) {
int a, b, c, s = 0, fa=0;
a = Integer.parseInt(txt18.getText());
b = Integer.parseInt(txt518.getText());
c = Integer.parseInt(txt5.getText());
fa = (a * 15) + (b * 13) + (c * 0);
txtFare.setText(Integer.toString(fa));
}
private void btnExitActionPerformed(java.awt.event.ActionEvent
evt) {
System.exit(0);
}

Anda mungkin juga menyukai