Вы находитесь на странице: 1из 70

D.A.V.

BURHAR PUBLIC
SCHOOL

INFORMATICS PRACTICES
2019-20

CLASS XII - ‘SCIENCE’


REPORT FILE
ROLL NO. –

SUBMITTED BY – SUBMITTED TO -
RISHI NARAYAN SINGH CHAUHAN VIJAY TIWARI SIR
CERTIFICATE
This is to certify that RISHI NARAYAN SINGH
CHAUHAN Class XII "Science" of DAV Public School Burhar,
Shahdol (M.P.) has completed his project file on " Workshop on
Net Beans and MySQL" under my supervision. He has taken
proper care and shown utmost sincerity in completion of this
project. I certify that his project is up to my expectation and as per
the guidelines issued by CBSE.

EXTERNAl's SIGN

Mr. Vijay Tiwari Sir Mr. S.K.Shrivastav


(I.P. Teacher) (Principal)
DAV Burhar , Shahdol (M.P.)

Roll No. :
Date Of Submission :
ACKNOWLEDGEMENT

I would like to express my special thanks to my Information


Practices Teacher Mr. Vijay Tiwari Sir, who gave me
golden opportunity to do this wonderful project on
"Workshop on NetBeans & My Sql" through which I came
to know about so many new things. I am really thankful to
them.
Secondly I would also like to thanks my parents and
friends who helped me a lot in finalizing this project within
limited time frame.

Rishi Narayan Singh Chauhan


Class- XII Science
Roll No.-
WORKSHOP 1

Coding for ‘Calculate Cost’

private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {

txtTCost.enable(false);

optWhole.setSelected(true);

private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void cmdCalcActionPerformed(java.awt.event.ActionEvent evt) {

int ordUnit; // Order unit

float TCost=0; // Total cost

float Discount = 0 ; // Discount price

ordUnit=Integer.parseInt(txtUnit.getText());

if (optWhole.isSelected())

if (ordUnit >= 1 && ordUnit <= 15)

TCost = ordUnit * 50;


else if (ordUnit >= 16 && ordUnit <= 20)

TCost = ordUnit * 45;

else if (ordUnit >= 21 && ordUnit <= 30)

TCost = ordUnit * 40;

else if (ordUnit >= 31 && ordUnit <= 50)

TCost = ordUnit * 35;

else if (ordUnit > 50)

TCost = ordUnit * 30;

else if (optRetail.isSelected())

if (ordUnit >= 1 && ordUnit <= 15)

TCost = ordUnit * 60;

else if (ordUnit >= 16 && ordUnit <= 20)

TCost = ordUnit * 55;

else if (ordUnit >= 21 && ordUnit <= 30)

TCost = ordUnit * 50;

else if (ordUnit >= 31 && ordUnit <= 50)

TCost = ordUnit * 45;

else if (ordUnit > 50)

TCost = ordUnit * 40;

// (i) Displaying discount

if (chkSpecial.isSelected())

Discount = TCost * (float)0.1;

txtDisc.setText(Float.toString(Discount));

// (ii) Displaying Total Cost

txtTCost.setText(Float.toString(TCost));

}
WORKSHOP 2

Coding for ‘Calculate’

private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {

txtECode.setText("");

txtEName.setText("");

txtBasic.setText("");

txtPHour.setText("");

txtHRA.setText("");

txtCCA.setText("");

txtTHour.setText("");

txtDays.setText("");

txtSalary.setText("");

txtOTAmount.setText("");

txtTSalary.setText("");

optPer.setSelected(false);

optTemp.setSelected(false);

private void cmdCalcActionPerformed(java.awt.event.ActionEvent evt) {

float basic = 0;
float HRA = 0;

float CCA = 0;

int oPOur = 0, oTOur=0; // Overtime hours

int NDays;

float OverTimeAmount=0;

float salAmt=0, TotalAmount=0;

// Step for permanent employee

if (optPer.isSelected())

basic = Float.parseFloat(txtBasic.getText());

oPOur = Integer.parseInt(txtPHour.getText());

HRA = basic * 10/100;

OverTimeAmount = oPOur * 75;

CCA = 500;

txtCCA.setText(String.valueOf(CCA));

txtHRA.setText(String.valueOf(HRA));

// Calculating salary amount

salAmt = basic + HRA + CCA;

else

// Step for temporary employee

if (optTemp.isSelected())

oTOur = Integer.parseInt(txtTHour.getText());

NDays =Integer.parseInt(txtDays.getText());

OverTimeAmount = oTOur * 50;

// Calculating salary amount

salAmt = NDays * 250;

// Calculating total salary

TotalAmount = salAmt + OverTimeAmount;

// Displaying salary, overtime amount and total salary


txtSalary.setText(String.valueOf(salAmt));

txtOTAmount.setText(String.valueOf(OverTimeAmount));

txtTSalary.setText(String.valueOf(TotalAmount));

optPer.setSelected(false);

optTemp.setSelected(false);

private void optPerStateChanged(javax.swing.event.ChangeEvent evt) {

private void optTempStateChanged(javax.swing.event.ChangeEvent evt) {

private void optPerActionPerformed(java.awt.event.ActionEvent evt) {

txtDays.setEditable(false);

txtTHour.setEditable(false);

txtBasic.setEditable(true);

txtPHour.setEditable(true);

txtHRA.setEditable(true);

txtCCA.setEditable(true);

private void optTempActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

txtBasic.setEditable(false);

txtPHour.setEditable(false);

txtHRA.setEditable(false);

txtCCA.setEditable(false);

txtDays.setEditable(true);

txtTHour.setEditable(true);
WORKSHOP 3

Coding for ‘Interest Amount’ & ‘Discount’

private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {

txtLAmount.setText("");

txtIntAmount.setText("");

txtDisc.setText("");

optCar.setSelected(true);

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void btnShowIntActionPerformed(java.awt.event.ActionEvent evt) {

// Calculating and showing interest amount

float IntAmt = 0;

if (optCar.isSelected())

IntAmt = Float.parseFloat(txtLAmount.getText()) * 10/100;

txtIntAmount.setText(String.valueOf(IntAmt));
}

else

if (optHouse.isSelected())

IntAmt = Float.parseFloat(txtLAmount.getText()) * (float) 8.5/100;

txtIntAmount.setText(String.valueOf(IntAmt));

else

if (optEdu.isSelected())

IntAmt = Float.parseFloat(txtLAmount.getText()) * 5/100;

txtIntAmount.setText(String.valueOf(IntAmt));

private void btnCalcDiscActionPerformed(java.awt.event.ActionEvent evt) {

float intAmt = Float.parseFloat(txtIntAmount.getText());

float discount=0, NetAmt = 0;

float amount = Float.parseFloat(txtLAmount.getText());

// Calculating discount on amount

if (amount<=1000000)

discount = amount * (float)(0.20/100);

if (amount>1000000)

discount = amount * (float)(0.25/100);

// Calculating net discount amount

NetAmt = intAmt - discount;

txtDisc.setText(String.valueOf(discount));

txtNAmount.setText(String.valueOf(NetAmt));

}
WORKSHOP 4

Coding for ‘Rate’ & ‘Amount’

private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {

// Clearing textboxes,radio buttons and check boxes.

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);

}
private void cmdRateActionPerformed(java.awt.event.ActionEvent evt) {

// Assigning rate per day

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));

private void cmdAmountActionPerformed(java.awt.event.ActionEvent evt) {

// Finding the cost of facility

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());

// Total amount

txtAmount.setText(Double.toString(TAmount));

private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

}
WORKSHOP 5

Coding for ‘Calculate Bill’

private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {

txtSTotal.enable(false);

txtTax.enable(false);

txtAmount.enable(false);

txtStay.enable(false);

// General category

optG.setSelected(true);

private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {

txtPNo.setText("");

txtPName.setText("");

txtDays.setText(String.valueOf(0));

txtDCharge.setText(String.valueOf(0));

txtOTCharge.setText(String.valueOf(0));

txtMedicine.setText(String.valueOf(0));

txtMeal.setText(String.valueOf(0));

txtSTotal.setText(String.valueOf(0));
txtStay.setText(String.valueOf(0));

txtTax.setText(String.valueOf(0));

txtAdvance.setText(String.valueOf(0));

txtAmount.setText(String.valueOf(0));

// General category

optG.setSelected(true);

private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void cmdBillActionPerformed(java.awt.event.ActionEvent evt) {

// Initializing variables for calculation

// Variables are declared to process bill

float sTotal = 0, tax = 0, TStayCharge = 0, Advance = 0, AmtToPay = 0;

float charge = 0, DCharge=0, OTCharge = 0, MCharge = 0, PMeal;

int days=0;

days = Integer.parseInt(txtDays.getText());

DCharge = Float.parseFloat(txtDCharge.getText());

OTCharge = Float.parseFloat(txtOTCharge.getText());

MCharge = Float.parseFloat(txtMedicine.getText());

PMeal = Float.parseFloat(txtMeal.getText());

Advance = Float.parseFloat(txtAdvance.getText());

if (optD.isSelected())

charge = 4000;

else

if (optP.isSelected())

charge = 2000;

else

if (optS.isSelected())
charge = 1000;

else

if (optG.isSelected())

charge = 400;

// Calculating Total Stay Charges

TStayCharge = charge * days;

// Calculating Sub Total

sTotal = TStayCharge + DCharge + OTCharge + MCharge + PMeal;

// Calculating Tax

tax = sTotal * 12/100;

// Calculating Amount to Pay

AmtToPay = (sTotal + tax) - Advance;

// Displaying details

txtSTotal.setText(String.valueOf(sTotal));

txtStay.setText(String.valueOf(TStayCharge));

txtTax.setText(String.valueOf(tax));

txtAmount.setText(String.valueOf(AmtToPay));

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new HospitalUI().setVisible(true);

});

}
WORKSHOP 6

Coding for ‘Calculate’

private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

txtPrincipal.setText("");

txtRate.setText("");

txtInterest.setText("");

txtAmount.setText("");

Opt5.setSelected(true); // Default button selected

txtPrincipal.setFocusable(true); // Focus to txtPrincipal

private void btnCalcActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int T = 0; // Time period

double CI = 0, Amount =0;

double P = Double.parseDouble(txtPrincipal.getText());

float R = Float.parseFloat(txtRate.getText());

if (Opt5.isSelected())

T = 5;
else

if (Opt10.isSelected())

T = 10;

else

if (Opt15.isSelected())

T = 15;

// pow() function calculates power of a number

CI = P * Math.pow((1 + (R/100)), T);

Amount = P + CI;

txtInterest.setText(String.valueOf(CI));

txtAmount.setText(String.valueOf(Amount));

private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {

txtInterest.enable(false);

txtAmount.enable(false);

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

}
WORKSHOP 7

Coding for ‘Calculate’

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) {

// TODO add your handling code here:

txtPrincipal.setText("");

txtTime.setText("");

txtRate.setText("");

txtInterest.setText("");

txtAmount.setText("");

txtDate.setText("");

optFD.setSelected(true); // Default button selected

optRD.setSelected(false); // Default button selected

}
private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void txtPrincipalActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

private void cmdCalculateActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int T = Integer.parseInt(txtTime.getText());

// Compound interest and total amount

double CI = 0, Amount =0;

// Principal amount

double P = Double.parseDouble(txtPrincipal.getText());

// Rate of interest

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 Sr. Citizen selected

if (chkSR.isSelected())

R = R + 2;

// Displaying Rate

txtRate.setText(Float.toString(R));

// pow() function calculates power of a number

CI = P * Math.pow((1 + (R/100)), T);

// Calculating total amount

Amount = P + CI;

txtInterest.setText(String.valueOf(CI));

txtAmount.setText(String.valueOf(Amount));

}
WORKSHOP 8

Coding for ‘Discount’

private void cmdDiscActionPerformed(java.awt.event.ActionEvent evt) {

// Caculating discount amount and net amount

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); // Default button selected

}
WORKSHOP 9

Coding for ‘Rate’ & ‘Amount’

System.exit(0);

private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {

txtName.setText("");

txtQty.setText("");

txtRate.setText("");

txtTop.setText("");

txtAmount.setText("");

optRegular.setSelected(true);

chkCheese.setSelected(true);

chkCap.setSelected(false);

chkPep.setSelected(false);

private void cmdCalcRateActionPerformed(java.awt.event.ActionEvent evt) {

if (optRegular.isSelected())

txtRate.setText(String.valueOf(220)); // String.valueOf convert integer to String


else

if (optPan.isSelected())

txtRate.setText(String.valueOf(260));

private void cmdCalcAmtActionPerformed(java.awt.event.ActionEvent evt) {

int Top = 0; // Topping cost

float Amt = 0; // Paizza amount

// Finding topping cost

if (chkCheese.isSelected())

Top = 40;

if (chkCap.isSelected())

Top = Top + 20;

if (chkPep.isSelected())

Top = Top + 25;

txtTop.setText(Integer.toString(Top));

// Finding Pizza order amount

Amt = (Integer.parseInt(txtRate.getText()) + Top) * Integer.parseInt(txtQty.getText());

txtAmount.setText(Float.toString(Amt));

}
WORKSHOP 10

Coding for ‘Calculate Total, Percentage & Grade’

private void cmdCalcActionPerformed(java.awt.event.ActionEvent evt) {

int R, eng, acc, bst, inf, eco, tot; // Marks and total

float per;

String Name, Gr="";

R = Integer.parseInt(txtRoll.getText());

eng = Integer.parseInt(txtEng.getText());

acc = Integer.parseInt(txtAcc.getText());

bst = Integer.parseInt(txtBst.getText());

inf = Integer.parseInt(txtInf.getText());

eco = Integer.parseInt(txtEco.getText());

// Total mark

tot = eng + acc + bst + inf + eco;

// Percentage

per = tot / 5;

if (per >= 90)

Gr = "A+";

else

if (per >= 80 && per < 90)

Gr = "A";

else
if (per >= 70 && per < 80)

Gr = "B";

else

if (per >= 60 && per < 70)

Gr = "C";

else

if (per >= 50 && per < 60)

Gr = "D";

else

if (per < 50)

Gr = "F";

// Displaying total, percentage and grade

txtTotal.setText(Integer.toString(tot));

txtPer.setText(Float.toString(per));

txtGr.setText(Gr);

private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

}
WORKSHOP 11

Coding for ‘Append’

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

jTextArea1.append("Friend's Data" + "\n"); // Roll No.

jTextArea1.append("Roll No.: " + jTextField1.getText() + "\n"); // Roll No.

jTextArea1.append("Name: " + jTextField2.getText() + "\n"); // Name

jTextArea1.append("Address: " + jTextField3.getText() + "\n"); // Address

jTextArea1.append("Section: " + jTextField4.getText() + "\n"); // Section

jTextArea1.append("Grade: " + jTextField5.getText() + "\n"); // Grade

}
WORKSHOP 12

Coding

private void cmdListActionPerformed(java.awt.event.ActionEvent evt) {

// Creating a String object City

String City = txtCity.getText();

// Creating a ListModel object dModel to perform DefaultListModel

// method operations

DefaultListModel dModel = (DefaultListModel) jList1.getModel();

// Method to add elements into jList1 control

dModel.addElement(City);

// Sets the data model for jList1 control

jList1.setModel(dModel);

private void cmdLCActionPerformed(java.awt.event.ActionEvent evt) {

// Creating a ListModel object dModel to perform DefaultListModel

// method operations

DefaultListModel dModel = (DefaultListModel) jList1.getModel();

// Clears the jList1 through DefaultListModel

dModel.clear();

}
private void cmdComboActionPerformed(java.awt.event.ActionEvent evt) {

// Creating a String object City

String City = txtCity.getText();

// Creating a ComboBoxModel object cModel to perform

// DefaultComboBoxModel method operations

DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel();

// Method to add elements into jComboBox1 control

cModel.addElement(City);

// Sets the data model for jComboBox1 control

jComboBox1.setModel(cModel);

private void cmdCCActionPerformed(java.awt.event.ActionEvent evt) {

// Creating a ComboBoxModel object cModel to perform

// DefaultComboBoxModel method operations

DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel();

// Clears the jComboBox1 through DefaultComboBoxModel

cModel.removeAllElements();

private void cmdLCIndActionPerformed(java.awt.event.ActionEvent evt) {

// Creating a String object City

String City = (String) jList1.getSelectedValue();

int ind = jList1.getSelectedIndex();

if (jList1.isSelectedIndex(ind)) {

// Creating a ListModel object dModel to perform DefaultListModel

// method operations

DefaultListModel dModel = (DefaultListModel) jList1.getModel();

// Remove the data at ind position

dModel.remove(ind);

// This displays the deleted item in a message box.


// Add the line, at top of the source code:

// import javax.swing.JOptionPane;

JOptionPane.showMessageDialog(this, "Deleted name " + City);

jList1.setModel(dModel);

} else

JOptionPane.showMessageDialog(this, "Note name is selected from list");

// TODO add your handling code here:

private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {

txtCity.setText("");

private void cmdCBIndActionPerformed(java.awt.event.ActionEvent evt) {

// Creating a String object City

String City = (String) jComboBox1.getSelectedItem();

int ind = jComboBox1.getSelectedIndex();

// Creating a ComboBoxModel object cModel to perform

// DefaultComboBoxModel method operations

DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel();

// Remove the data at ind position

cModel.removeElementAt(ind);

// This displays the deleted item in a message box.

// Add the line, at top of the source code: import javax.swing.JOptionPane;

JOptionPane.showMessageDialog(this, "Deleted name " + City);

jComboBox1.setModel(cModel);

}
WORKSHOP 13

Coding for ‘List Price, Discount Price, Net Price’

private void cmdNetActionPerformed(java.awt.event.ActionEvent evt) {

float NetPrice;

NetPrice = Float.parseFloat(txtLPrice.getText()) - Float.parseFloat(txtDiscount.getText());

txtNPrice.setText(Float.toString(NetPrice));

private void cmdListActionPerformed(java.awt.event.ActionEvent evt) {

String Product = cmbProduct.getSelectedItem().toString();

if (Product.equals("Washing Machine")) {

txtLPrice.setText("12000");

} else if (Product.equals("Color Television")) {

txtLPrice.setText("17000");

} else if (Product.equals("Refrigerator")) {

txtLPrice.setText("18000");

} else if (Product.equals("OTG")) {

txtLPrice.setText("8000");

} else if (Product.equals("CD Player")) {

txtLPrice.setText("14500");

}
}

private void cmdDiscActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

float ProductPrice, Discount;

ProductPrice = Float.parseFloat(txtLPrice.getText());

// Calculating Discount Price

if (optFest.isSelected()) {

Discount = ProductPrice * 17 /100;

} else {

Discount = ProductPrice * 10 /100;

txtDiscount.setText(Float.toString(Discount));

private void cndExutActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

}
WORKSHOP 14

Coding for ‘Calculate Fare’

class Tour

String TCode;

int NoofAdults;

int NoofKids;

int Kilometres;

float TotalFare;

Tour()

TCode = " ";

NoofAdults = 0;

NoofKids = 0;

Kilometres = 0;

TotalFare = 0;

// Class member function to input the values of the data members

void EnterTour()

TCode = txtCode.getText();

NoofAdults = Integer.parseInt(txtA.getText());

NoofKids = Integer.parseInt(txtK.getText());

Kilometres = Integer.parseInt(txtKL.getText());

}
// Class member function to calculate tour fare

void AssignFare()

float Fare = 0;

if (Kilometres < 500)

Fare = (NoofAdults * 200) + (NoofKids * 100);

else

if ((Kilometres >= 500) && (Kilometres < 1000))

Fare = (NoofAdults * 300) + (NoofKids * 150);

else

if (Kilometres >= 1000)

Fare = (NoofAdults * 500) + (NoofKids * 250);

TotalFare = Fare;

// Class member functions to display total fare

void ShowFare()

txtFare.setText(Float.toString(TotalFare));

private void btnFActionPerformed(java.awt.event.ActionEvent evt) {

// Tourt class object

Tour TR = new Tour();

// Member method accessed through class object

TR.EnterTour();

TR.AssignFare();

TR.ShowFare();

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

}
WORKSHOP 15

Coding for ‘Discount, Net Amount’

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

float BillAmt, NetAmt, Disc;

String ModeofPayment;

BillAmt = Float.parseFloat(txtBillAmt.getText());

ModeofPayment = (String) cmbMode.getSelectedItem();

if (ModeofPayment.equals("Cash"))

Disc = BillAmt*8/100;

else if (ModeofPayment.equals("Cheque"))

Disc = BillAmt*7/100;

else Disc = 0;

if (BillAmt > 1500)

Disc = Disc + BillAmt*10/100;

btnCalcNetAmt.setEnabled(true);

txtDisc.setText(Disc+ " ");

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:

System.exit(0);

private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {

// TODO add your handling code here:

txtDisc.setEditable(false);

txtNetAmt.setEditable(false);

private void btnCalcNetAmtActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

float BillAmt, NetAmt, Disc;

BillAmt = Float.parseFloat(txtBillAmt.getText());

Disc = Float.parseFloat(txtDisc.getText());

NetAmt = BillAmt - Disc;

txtNetAmt.setText(NetAmt+ " ");

}
WORKSHOP 16

Coding for ‘Price’

class Garments

int GCode;

String GType;

int GSize;

String GFabric;

float GPrice;

// Constructor to assign initial values

Garments()

GCode = 0;

GType = "NOT ALLOTTED";

GFabric = "NOT ALLOTTED";

GSize = 0;

GPrice = 0;

// Function to calculate value

void Assign()

// Compares string

if (GFabric.compareToIgnoreCase("TROUSER") == 0)

GPrice = 1300;
}

else

if (GFabric.compareToIgnoreCase("SHIRT") == 0)

GPrice = 1100 - (1100 * (10/100));

// Function to input the values

void Input()

GCode = Integer.parseInt(txtFcode.getText());

GType = txtFtype.getText();

GSize = Integer.parseInt(txtFsize.getText());

GFabric = txtF.getText().toUpperCase();

Assign();

// Function to display values

void Display()

txtPrice.setText(Float.toString(GPrice));

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void btnFActionPerformed(java.awt.event.ActionEvent evt) {

// Garments class object

Garments GR = new Garments();

// Member method accessed through class object

GR.Input();

GR.Display();

}
WORKSHOP 17

Coding for ‘Calculate’

private void clButtonActionPerformed(java.awt.event.ActionEvent evt) {

float esal; // Monthly salary

float da=0; // Dearness allowance

float hra=0; // House rent allowance

float gross=0; // Gross salary

float anSal=0; // Annual salary

float tax=0; // Annual Tax

float monTax=0; // Monthly tax

float netSal=0; // Monthly salary

esal = Float.parseFloat(txtSal.getText());

if (esal >= 20000)

da = esal * 40/100;

hra = esal * 30/100;

else

if ((esal >= 15000) && (esal < 20000))

da = esal * 40/100;

hra = esal * 25/100;


}

else

if ((esal < 15000) && (esal > 12000))

da = esal * 30/100;

hra = esal * 20/100;

else

if (esal <= 12000)

da = esal * 30/100;

hra = esal * 15/100;

gross = esal + da + hra;

anSal = gross * 12;

if (anSal > 200000)

if ((anSal >= 200000) && (anSal < 500000))

tax = (anSal - 200000) * 10/100;

else

if ((anSal >= 500000) && (anSal < 1000000))

tax = 30000 + (anSal - 500000) * 20/100;

else

if (anSal >= 1000000)

tax = 130000 + (anSal - 1000000) * 30/100;

monTax = tax / 12;


netSal = gross - tax / 12;

else

tax = 0;

monTax = 0;

txtDA.setText(Float.toString(da));

txtHRA.setText(Float.toString(hra));

txtGross.setText(Float.toString(gross));

txtAn.setText(Float.toString(anSal));

txtTax.setText(Float.toString(tax));

txtTaxMon.setText(Float.toString(monTax));

txtNet.setText(Float.toString(netSal));

private void exButtonActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

}
WORKSHOP 18

Coding for ‘Discount, Net Amount’

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField4.setText(""+0);

jTextField5.setText(""+0);

jTextField4.setEditable(false);

jTextField5.setEditable(false);

float Discount = 0; // For discount

float AddDiscount = 0; // For additional discount

if (jRadioButton1.isSelected())

Discount = Float.parseFloat(jTextField2.getText()) * 20/200;

else

if (jRadioButton2.isSelected())

Discount = Float.parseFloat(jTextField2.getText()) * 15/200;

else

if (jRadioButton3.isSelected())

Discount = Float.parseFloat(jTextField2.getText()) * 10/200;

// Displaying the discount amount in jTextField3

jTextField3.setText(String.valueOf(Discount));

// Calculating additional discount amount


if (Float.parseFloat(jTextField2.getText()) > 25000)

AddDiscount = Float.parseFloat(jTextField2.getText()) * 5/100;

// Displaying the additionl discount amount in jTextField4

jTextField4.setText(String.valueOf(AddDiscount));

// Enabling jButton2

jButton2.setEnabled(true);

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

float NetAmt = 0;

NetAmt = (Float.parseFloat(jTextField2.getText()) - Float.parseFloat(jTextField3.getText()) - Float.parseFloat(jTextField4.getText()));

jTextField5.setText(String.valueOf(NetAmt));

}
WORKSHOP 19

Coding for ‘Generate Bill’

private void blButtonActionPerformed(java.awt.event.ActionEvent evt) {

int units;

double charges = 0;

units = Integer.parseInt(txtBill.getText());

// Charges for Non Domestic Light

if (jRadioButton2.isSelected())

// Set enabled to JCheckBoxes

jCheckBox1.setEnabled(true);

jCheckBox2.setEnabled(true);

if (jCheckBox1.isSelected())

// Charges for Non Domestic Light up to 10 KW

charges = units * 5.40;

else

if (jCheckBox2.isSelected())

{
// Charges for Non Domestic Light Above 10 KW

charges = units * 4.92;

// Charges for Agricultural power

if (jRadioButton3.isSelected())

// Set enabled to JCheckBoxes

jCheckBox1.setEnabled(true);

jCheckBox2.setEnabled(true);

if (jCheckBox1.isSelected())

// Charges for Agricultural Power up to 10 KW

charges = units * 1.55;

else

if (jCheckBox2.isSelected())

// Charges for Agricultural Power Above 10 KW

charges = units * 9.84;

// Charges for Industrial Power

if (jRadioButton4.isSelected())

// Set enabled to JCheckBoxes

jCheckBox1.setEnabled(true);

jCheckBox2.setEnabled(true);

if (jCheckBox1.isSelected())

// Charges for Industrial Power up to 10 KW


charges = units * 5.05;

else

if (jCheckBox2.isSelected())

// Charges for Industrial Power Above 10 KW

charges = units * 4.40;

// Charges for Domestic Light

if (jRadioButton1.isSelected())

// Set disabled to JCheckBoxes

jCheckBox1.setEnabled(false);

jCheckBox2.setEnabled(false);

// The code calculate the charges on decremented unit values.

if (units <= 200)

charges = (units * 2.45);

else

if (units <= 400)

charges = ((units - 200) * 3.95) + 490;

else

if (units > 400)

// Here, Rs 1280 for first 200 units and next 200 units

charges = ((units - 400) * 4.65) + 1280;

jLabel2.setText("The charges is : " + charges);

private void exButtonActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

}
WORKSHOP 20

Coding for ‘Calculate’

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void btnAreaActionPerformed(java.awt.event.ActionEvent evt) {

// Price of pencil

float price = Float.parseFloat(jTextField1.getText());

// Quantity of pencil

int qty = Integer.parseInt(jTextField2.getText());

// Total price

float tot = price * qty;

// Tax amount

float tax = tot * 10/100;

jTextField3.setText("" +tot);

jTextField4.setText("" +tax);

}
WORKSHOP 21

Coding

private void btnDisActionPerformed(java.awt.event.ActionEvent evt) {

txtPer.enable(false);

txtGr.enable(false);

optMed.setSelected(true); // Default button selected

optNMed.setSelected(false);

private void cmdClearActionPerformed(java.awt.event.ActionEvent evt) {

txtFirst.setText("");

txtSecond.setText("");

txtPer.setText("");

txtGr.setText("");

chkNCC.setSelected(false);

optMed.setSelected(true); // Default button selected

optNMed.setSelected(false);

private void cmdCalcPerActionPerformed(java.awt.event.ActionEvent evt) {

int fTerm, sTerm;

int Total=0;
float per=0;

fTerm = Integer.parseInt(txtFirst.getText());

sTerm = Integer.parseInt(txtSecond.getText());

Total = fTerm + sTerm; // Total marks

per = Total/2; // Percentage of marks

if (chkNCC.isSelected())

per = per + 3; // Extra 3% is given as NCC Cadet

// Displaying percentage

txtPer.setText(Float.toString(per));

private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void cmdCalcGradeActionPerformed(java.awt.event.ActionEvent evt) {

float per = Float.valueOf(txtPer.getText());

String gr="";

// Medical section

if (optMed.isSelected())

if (per >= 80)

gr = "A";

else

if (per >= 60 && per <= 79)

gr = "B";

else

if (per < 60)

gr = "C";

// Non-Medical section

else
if (optNMed.isSelected())

if (per >= 75)

gr = "A";

else

if (per >= 50 && per <= 74)

gr = "B";

else

if (per < 50)

gr = "C";

txtGr.setText(gr);

}
WORKSHOP 22

Coding

class Worker

int wno;

String wname;

float hrwrk;

float wgrate;

float totwage;

float calcwg( )

return(hrwrk * wgrate);

void in_data( )

wno = Integer.parseInt(txtWno.getText());

wname = txtWname.getText();

hrwrk = Float.parseFloat(txtHour.getText());

wgrate = Float.parseFloat(txtWRate.getText());

totwage = calcwg( );

void out_data( )
{

txtWage.setText(Float.toString(totwage));

private void btnWageActionPerformed(java.awt.event.ActionEvent evt) {

// Worker class object

Worker WK = new Worker();

// Member method accessed through class object

WK.in_data();

WK.out_data();

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);

}
WORKSHOP 23

Coding

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

txtName.setText("");

txtDays.setText("");

txtWage.setText("");

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int WageRate, NoOfDays, TotalPay;

if (radMale.isSelected())

WageRate = 140;

else WageRate = 160;


if (chkSkilled.isSelected())

WageRate += 50;

NoOfDays = Integer.parseInt(txtDays.getText());

TotalPay = NoOfDays * WageRate;

txtWage.setText(""+TotalPay);

}
WORKSHOP 24

CREATE TABLE Loan_Account

(AccNo INT(3) PRIMARY KEY,

Cust_Name VARCHAR(20) NOT NULL,

Loan_Amount DOUBLE(10,2),

Instalments INT(3),

Int_Rate FLOAT(5,2),

Start_Date DATE,

Interest DOUBLE(8,2));

INSERT INTO LOAN_ACCOUNT (AccNo, Cust_Name, Loan_Amount, Instalments, Int_Rate, Start_Date)

VALUES(1, 'R.K. Gupta', 300000, 36, 12.00, '2009-07-19');

INSERT INTO LOAN_ACCOUNT (AccNo, Cust_Name, Loan_Amount, Instalments, Int_Rate, Start_Date)

VALUES(2, 'S.P. Sharma', 500000, 48, 10.00, '2008-03-22');

INSERT INTO LOAN_ACCOUNT (AccNo, Cust_Name, Loan_Amount, Instalments, Int_Rate, Start_Date)

VALUES(3, 'K.P. Jain', 300000, 36, NULL, '2007-03-08');

INSERT INTO LOAN_ACCOUNT (AccNo, Cust_Name, Loan_Amount, Instalments, Int_Rate, Start_Date)

VALUES(4, 'M.P. Yadav', 800000, 60, 10.00, '2008-06-12');

INSERT INTO LOAN_ACCOUNT (AccNo, Cust_Name, Loan_Amount, Instalments, Int_Rate, Start_Date)

VALUES(5, 'S.P. Sinha', 200000, 36, 12.50, '2010-01-03');

INSERT INTO LOAN_ACCOUNT (AccNo, Cust_Name, Loan_Amount, Instalments, Int_Rate, Start_Date)

VALUES(6, 'P. Sharma', 700000, 60, 12.50, '2008-06-05');

INSERT INTO LOAN_ACCOUNT (AccNo, Cust_Name, Loan_Amount, Instalments, Int_Rate, Start_Date)

VALUES(7, 'K.S. Dhall', 500000, 48, NULL, '2008-03-05');


WORKSHOP 25

CREATE TABLE Loan_Account

(AccNo INT(3) PRIMARY KEY,

Cust_Name VARCHAR(20) NOT NULL,

Loan_Amount DOUBLE(10,2),

Instalments INT(3),

Int_Rate FLOAT(5,2),

Start_Date DATE,

Interest DOUBLE(8,2));

INSERT INTO CONSIGNEE VALUES('MU05', 'ND01', 'Rahul Kishore', '5, Park Avenue', 'Mumbai');

INSERT INTO CONSIGNEE VALUES('ND08', 'ND02', 'P Dhingra', '16/J, Moore Enclave', 'New Delhi');

INSERT INTO CONSIGNEE VALUES('KO19', 'MU15', 'A P Roy', '2A, Central Avenue', 'Kolkata');

INSERT INTO CONSIGNEE VALUES('MU32', 'ND02', 'S Mittal', 'P 245, AB Colony', 'Mumbai');

INSERT INTO CONSIGNEE VALUES('ND48', 'MU50', 'B P Jain', '13, Block D, A Vihar', 'New Delhi');
WORKSHOP 26

CREATE TABLE CONSIGNOR

(CnorID CHAR(4) PRIMARY KEY,

CnorName VARCHAR(20),

CnorAddress VARCHAR(25),

City VARCHAR(20));

INSERT INTO CONSIGNOR VALUES('ND01', 'R Singhal', '24, ABC Enclave', 'New Delhi');

INSERT INTO CONSIGNOR VALUES('ND02', 'Amit Kumar', '123, Palm Avenue', 'New Delhi');

INSERT INTO CONSIGNOR VALUES('MU15', 'R Kohli', '5/A, South Street', 'Mumbai');

INSERT INTO CONSIGNOR VALUES('MU50', 'S Kaur', '27-K, Westend', 'Mumbai');


WORKSHOP 27

CREATE TABLE CLUB

(COACH_ID INT(2) PRIMARY KEY,

COACHNAME VARCHAR(20),

AGE INT(2),

SPORTS VARCHAR(15),

DATEOFAPP DATE,

PAY FLOAT,

SEX CHAR(1));

insert into CLUB values (1, 'KUKREJA', 35, 'KARATE', '1996-03-27', 1000, 'M');

insert into CLUB values (2, 'RAVINA', 34, 'KARATE', '1998-01-20', 1200, 'F');

insert into CLUB values (3, 'KARAN', 34, 'SQUASH', '1998-02-19', 2000, 'M');

insert into CLUB values (4, 'TARUN' ,33, 'BASKETBALL', '1998-01-01', 1500, 'M');

insert into CLUB values (5, 'ZUBIN' ,36, 'SWIMMING', '1998-01-12', 750, 'M');

insert into CLUB values (6, 'KETAKI' ,36, 'SWIMMING', '1998-02-24', 800, 'F');

insert into CLUB values (7, 'ANKITA' ,39, 'SQUASH', '1998-02-20', 2200, 'F');

insert into CLUB values (8, 'ZAREEN', 37, 'KARATE', '1998-02-22', 1100, 'F');

insert into CLUB values (9, 'KUSH', 41, 'SWIMMING', '1998-01-13', 900, 'M');

insert into CLUB values (10, 'SHAILYA' ,37, 'BASKETBALL', '1998-02-19', 1700, 'M');
WORKSHOP 28

CREATE TABLE EMPSALARY

(EMPID INT(4),

SALARY DOUBLE(8,2),

BENEFITS DOUBLE(7,2),

DESIGNATION VARCHAR(15));

INSERT INTO EMPSALARY VALUES(010, 75000, 15000, 'Manager');

INSERT INTO EMPSALARY VALUES(105, 65000, 15000, 'Manager');

INSERT INTO EMPSALARY VALUES(152, 80000, 25000, 'Director');

INSERT INTO EMPSALARY VALUES(215, 75000, 12500, 'Manager');

INSERT INTO EMPSALARY VALUES(244, 50000, 12000, 'Clerk');

INSERT INTO EMPSALARY VALUES(300, 45000, 10000, 'Clerk');

INSERT INTO EMPSALARY VALUES(335, 40000, 10000, 'Clerk');

INSERT INTO EMPSALARY VALUES(400, 32000, 7500, 'Salesman');

INSERT INTO EMPSALARY VALUES(441, 28000, 7500, 'Salesman');


WORKSHOP 29

CREATE TABLE FARES

(FL_NO CHAR(5) PRIMARY KEY,

AIRLINES VARCHAR(15),

FARE FLOAT,

TAXRATE INT(2));

INSERT INTO FARES VALUES('IC701', 'India Airlines', 6500, 10);

INSERT INTO FARES VALUES('MU499', 'Sahara', 9400, 5);

INSERT INTO FARES VALUES('AM501', 'Jet Airways', 13400, 8);

INSERT INTO FARES VALUES('IC899', 'Indian Airlines', 8300, 4);

INSERT INTO FARES VALUES('IC302', 'Indian Airlines', 4300, 10);

INSERT INTO FARES VALUES('UC799', 'Indian Airlines', 10500, 10);

INSERT INTO FARES VALUES('MC101', 'Deccan Airlines', 3500, 4);


WORKSHOP 30

CREATE TABLE FLIGHTS

(FL_NO CHAR(5) PRIMARY KEY,

START VARCHAR(15),

ENDING VARCHAR(15),

NO_FLIGHTS INT(2),

NO_STOPS INT(2));

INSERT INTO FLIGHTS VALUES('IC301', 'MUMBAI', 'DELHI', 8, 0);

INSERT INTO FLIGHTS VALUES('IC799', 'BANGALORE', 'DELHI', 2, 1);

INSERT INTO FLIGHTS VALUES('MC101', 'INDORE', 'MUMBAI', 3, 0);

INSERT INTO FLIGHTS VALUES('IC302', 'DELHI', 'MUMBAI', 8, 0);

INSERT INTO FLIGHTS VALUES('AM812', 'KANPUR', 'BANGALORE', 3, 1);

INSERT INTO FLIGHTS VALUES('IC899', 'MUMBAI', 'KOCHI', 1, 4);

INSERT INTO FLIGHTS VALUES('AM501', 'DELHI', 'TRIVANDRUM', 1, 5);

INSERT INTO FLIGHTS VALUES('MU499', 'MUMBAI', 'MADRAS', 3, 3);

INSERT INTO FLIGHTS VALUES('IC701', 'DELHI', 'AHMEDABAD', 4, 0);


WORKSHOP 31

CREATE TABLE SAL

(SID INT(4) PRIMARY KEY,

BASIC FLOAT,

ALLOWANCE FLOAT,

COMM_PER INT(2));

INSERT INTO SAL VALUES(101, 12000, 1000, 3);

INSERT INTO SAL VALUES(104, 23000, 2300, 5);

INSERT INTO SAL VALUES(107, 32000, 4000, 5);

INSERT INTO SAL VALUES(114, 12000, 5200, 10);

INSERT INTO SAL VALUES(109, 42000, 1700, 20);

INSERT INTO SAL VALUES(105, 18900, 1690, 3);

INSERT INTO SAL VALUES(130, 21700, 2600, 30);


WORKSHOP 32

CREATE TABLE STAFF

(SID INT(4) PRIMARY KEY,

NAME VARCHAR(20),

DEPT VARCHAR(15),

SEX CHAR(1),

EXPERIENCE INT(2));

INSERT INTO STAFF VALUES(101, 'Siddharth', 'SALES', 'M', 12);

INSERT INTO STAFF VALUES(104, 'Raghav', 'FINANCE', 'M', 5);

INSERT INTO STAFF VALUES(107, 'Naman', 'RESEARCH', 'M', 10);

INSERT INTO STAFF VALUES(114, 'Nupur', 'SALES', 'F', 3);

INSERT INTO STAFF VALUES(109, 'Janvi', 'FINANCE', 'F', 9);

INSERT INTO STAFF VALUES(105, 'Rama', 'RESEARCH', 'M', 10);

INSERT INTO STAFF VALUES(117, 'James', 'SALES', 'F', 3);

INSERT INTO STAFF VALUES(111, 'Binoy', 'FINANCE', 'F', 12);

INSERT INTO STAFF VALUES(130, 'Samuel', 'SALES', 'M', 15);


WORKSHOP 33

CREATE TABLE SENDER

(SenderID CHAR(4) PRIMARY KEY,

SenderName VARCHAR(20),

SenderAddress VARCHAR(25),

SenderCity VARCHAR(15));

INSERT INTO SENDER VALUES('ND01', 'R Jain', '2, ABC Appts', 'New Delhi');

INSERT INTO SENDER VALUES('MU02', 'H Sinha', '12, Newtown', 'Mumbai');

INSERT INTO SENDER VALUES('MU15', 'S Jha', '27/A, Park Street', 'Mumbai');

INSERT INTO SENDER VALUES('ND50', 'T Prasad', '122-k, SDA', 'New Delhi');
WORKSHOP 34

CREATE TABLE RECIPIENT

(RecID CHAR(4) PRIMARY KEY,

SenderID CHAR(4),

RecName VARCHAR(20),

RecAddress VARCHAR(30),

RecCity VARCHAR(15),

FOREIGN KEY (SenderID) REFERENCES SENDER(SenderID));

INSERT INTO RECIPIENT VALUES('KO05', 'ND01', 'R Bajpayee', '5, Central Avenue', 'Kolkata');

INSERT INTO RECIPIENT VALUES('ND08', 'MU02', 'S Mahajan', '116, A Vihar', 'New Delhi');

INSERT INTO RECIPIENT VALUES('MU19', 'ND01', 'H Singh', '2A, Andheri East', 'Mumbai');

INSERT INTO RECIPIENT VALUES('MU32', 'MU15', 'P K Swamy', 'B5, C S Terminus', 'Mumbai');

INSERT INTO RECIPIENT VALUES('ND48', 'ND50', 'S Tripathi', '13, B1 D, Mayur Vihar', 'New Delhi');
WORKSHOP 35

CREATE TABLE STATIONERY

(S_ID CHAR(4) PRIMARY KEY,

StationeryName VARCHAR(25),

Company VARCHAR(20),

Price FLOAT);

INSERT INTO STATIONERY VALUES('DP01', 'Dot Pen', 'ABC', 10);

INSERT INTO STATIONERY VALUES('PL02', 'Pencil', 'XYZ', 6);

INSERT INTO STATIONERY VALUES('ER05', 'Eraser', 'XYZ', 7);

INSERT INTO STATIONERY VALUES('PL01', 'Pencil', 'CAM', 5);

INSERT INTO STATIONERY VALUES('GP02', 'Gel Pen', 'ABC', 15);


WORKSHOP 36

CREATE TABLE CONSUMER

(C_ID INT(3) PRIMARY KEY,

CunsumerName VARCHAR(25),

Address VARCHAR(25),

S_ID CHAR(4),

FOREIGN KEY (S_ID) REFERENCES STATIONERY(S_ID));

INSERT INTO CONSUMER VALUES(01, 'Good Learner', 'Delhi', 'PL01');

INSERT INTO CONSUMER VALUES(06, 'Write Well', 'Mumbai', 'GP02');

INSERT INTO CONSUMER VALUES(12, 'Topper', 'Delhi', 'DP01');

INSERT INTO CONSUMER VALUES(15, 'Write & Draw', 'Delhi', 'PL02');

INSERT INTO CONSUMER VALUES(16, 'Motivation', 'Bangalore', 'PL01');


WORKSHOP 37

CREATE TABLE GRADUATE

(SNO INT(3) PRIMARY KEY,

NAME VARCHAR(20),

STIPEND INT(5),

SUBJECT VARCHAR(15),

AVERAGE FLOAT,

DIVISION INT(2));

insert into graduate VALUES(1, 'KARAN', 400, 'PHYSICS', 68, 1);

insert into graduate VALUES(2, 'DIVAKAR', 450, 'COMPUTER SC', 68, 1);

insert into graduate VALUES(3, 'DIVYA', 300, 'CHEMISTRY', 62, 2);

insert into graduate VALUES(4, 'ARUN', 350, 'PHYSICS', 63, 1);

insert into graduate VALUES(5, 'SABINA', 500, 'MATHEMATICS', 70, 1);

insert into graduate VALUES(6, 'JOHN', 400, 'CHEMISTRY', 55, 2);

insert into graduate VALUES(7, 'ROBERT', 250, 'PHYSICS', 64, 1);

insert into graduate VALUES(8, 'RUBINA', 450, 'MATHEMATICS', 68, 1);

insert into graduate VALUES(9, 'VIKAS', 500, 'COMPUTER SC', 62, 1);

insert into graduate VALUES(10, 'MOHAN', 300, 'MATHEMATICS', 57, 2);


WORKSHOP 38

CREATE TABLE HOSPITAL

(PNo Int(4) Primary key,

Name Varchar(20) NOT NULL,

Age Int(2),

Department Varchar(18),

Dateofadm Date,

Charges Double(7,2),

Sex Char(1));

INSERT INTO HOSPITAL VALUES(1, 'Arprit', 62, 'Surgery', '2008-01-12', 300, 'M');

INSERT INTO HOSPITAL VALUES(2, 'Zarina', 22, 'ENT', '2007-12-12', 250, 'F');

INSERT INTO HOSPITAL VALUES(3, 'Kareem', 32, 'Orthopaedic', '2008-02-19', 200, 'M');

INSERT INTO HOSPITAL VALUES(4, 'Arun', 12, 'Surgery', '2008-01-11', 300, 'M');

INSERT INTO HOSPITAL VALUES(5, 'Zubin', 30, 'ENT', '2008-01-12', 250, 'M');

INSERT INTO HOSPITAL VALUES(6, 'Ketaki', 16, 'ENT', '2008-02-24', 250, 'F');

INSERT INTO HOSPITAL VALUES(7, 'Ankita', 29, 'Cardiology', '2008-02-20', 800, 'F');

INSERT INTO HOSPITAL VALUES(8, 'Zareen', 45, 'Gynaecology', '2008-02-22', 300, 'F');

INSERT INTO HOSPITAL VALUES(9, 'Kush', 19, 'Cardiology', '2008-01-13', 800, 'M');

INSERT INTO HOSPITAL VALUES(10, 'Shilpa', 23, 'Nuclear Medicine', '2008-01-20', 400, 'F');
WORKSHOP 39

create table student

(rollno INT not null primary key,

name varchar(25),

address varchar(30),

sclass char(4),

section char(1),

dob date);

INSERT INTO STUDENT VALUES (1, 'Avnish Gupta', 'A-1/34, Sec-22, Saket, Delhi', 'XII', 'A', '1994-10-
10');

INSERT INTO STUDENT VALUES (2, 'Piyush Chawala', 'B/1-100, Kamla Narag, Delhi', 'XII','A', '1995-03-
28');

INSERT INTO STUDENT VALUES (3, 'Lokesh Verma', '11-B, Ph-II, A. Vihar, Delhi', 'XII','A', '1994-08-02');

INSERT INTO STUDENT VALUES (4, 'Arti Sehgal', '18-C, Ph-I, Ashok Vihar, Delhi', 'XII','A', '1995-11-22');

INSERT INTO STUDENT VALUES (5, 'Priyanka Lamba', 'C-1/10, Laxmi Colony, Delhi', 'XII','A', '1994-07-
26');

INSERT INTO STUDENT VALUES (6, 'R. Raman', '145, Roop Nagar, Delhi', 'XII','A', '1995-04-17');

INSERT INTO STUDENT VALUES (7, 'S. Vidyanathan', 'B-1/140, Lawrence Road, Delhi', 'XII','A', '1995-
04-17');

Вам также может понравиться