Sunteți pe pagina 1din 141

PRACTICAL FILE

OF
INFORMATICS PRACTICES
SESSION : 2019-20
BY
Tarun Kumar Roy

UNDER THE GUIDANCE OF


MRS. LALITA CHATTERJEE

FOR THE PARTIAL FULFILMENT OF


CLASS XII, CBSE NEW DELHI

SUBMITTED TO
JAWAHARLAL NEHRU SCHOOL
BHEL, BHOPAL.

ACKNOWLEDGEMENT
Ispecial
would thanks
like to express
of my to
gratitude
my teachers as
Chatterjee Mrs.
wellLalita
as our
school
SHRADHA principal Mrs.
MAJUMDAR who
gave us students
opportunity the
to do this golden
wonderful project on the topic
of INFORMATICS
which also helped PRACTICE,
me in doing
lot
knowof research
about so and
many I came
things,to I
am really Ithankful
Secondly would to them.
also like to
thank
who my
helped parents
me and
a lot in friends
finalizing
limited time frame. within the
this project

Tarun Kumar Roy

CERTIFICATE
This is to certify that Tarun Kumar Roy has
successfully completed the practical file with the help of Java
Programming Language and MySQL under my guidance and
supervision.
I am Satisfied with his initiatives and efforts for the
completion of this practical file as a part of CBSE class XII
Examination.

Date:
Place: BHOPAL

Signature of Internal Examiner: Signature of External Examiner:


CONTENTS
SECTION: A - Java
1. Student’s Mark sheet.
2. Electronic Appliances.
3. Sales Incentives.
4. Big Bazar Shipment.
5. Apollo Family Care Hospital.
6. Amusement Park.
7. Glamour Garments.
8. Alpha Builders.
9. Kiddi Land Enterprises.
10. Ducom Enterprises.
11. Recreation Park.
12. Club Mahindra.
13. McDonald’s India.
14. HSBC Bank.
15. Garment Exporting Housing.
16. Maxwell Public School.
17. Class Concept.
18. Constructor in a Class.
19. Rectangle Class.
20. Class Employee.
21. Class Resort.
22. Class Travel Plan.
23. Sunrise Tourism.
24. Factorial Using Class Inheritance.
25. Method Overloading.
26. Method Overriding.
27. Extracting MySQL Database Records Using jTable Control.
28. Inserting Database Records.
SECTION: B - MySQL
1. Employee Table.
2. Course Table.
3. Toy_Shoppe Table.
4. Admission Table.
5. Infant Table.
6. Fitness Table.
7. Employee Table.
8. Product and Client Table.
9. Club and Coaches Table.
10. Garment and Fabrics Table.
11. Supplier and Product Table.
12. Bank and Customer Table.
13. Doctors and Patients Table.
14. Flights and Fares.

SECTION: C - HTML
1. Combining List Types.
2. Cells that span more than one or column.
3. Hyperlinks on cotexts

JAVA
SECTION-A

1-STUDENT’S MARKSHEET.

DOCUMENTATION
Name of the project: Student’sMarksheet.java
Description of the project: Create a Java desktop application to perform
the following calculations:
• Calculation of total and Average marks
Total=English+maths+physics+chemistry+I.P
Average=total/5
• Displaying the Distinction/Average marks based on the total marks
scored.
• Displaying the grade(A,B,C,D,E,F)based on the average marks scored.
Average Result Grade
>=75 Distinction A
>=60 First Class B
>=50 Second Class C
>=40 Average D
Otherwise Fail F

Enter five subject’s marks called: English, maths, physics, chemistry, I.P. Also
the entered marks should be between 0 and 100 for each subject.

Variable Controls Are As follows:


CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtEng
jTextField2 txtPhy
jTextField3 txtChem
jTextField4 txtIP
jTextField5 txtMaths
jTextField6 txtTot
jTextField7 txtAvg
jTextField8 txtResult
jTextField9 txtGrade
jButton1 ComputeBTN
jButton2 ExitBTN

Questions:
• Using a JButton(Compute) event handler, show the total, average result
and grade in different JTextFields control.

• Write the code for clear button to clear all the TextFields content.

• Write the code for Exit button to exit the application.

Operating System used: Windows 10


Version of NetBeans used: NetBeans IDE 6.5.1

SCREENSHOT

CODING
For Compute Button:
private void ComputeBTNActionPerformed(java.awt.event.ActionEvent evt)
{
int Total=0;
int physics=Integer.parseInt(txtPhy.getText());
int maths=Integer.parseInt(txtMaths.getText());
int chemistry=Integer.parseInt(txtChem.getText());
int IP=Integer.parseInt(txtIP.getText());
int english=Integer.parseInt(txteng.getText());
Total=physics+math+chemistry+IP+english;
txtTot.setText(“”+Total);
int average=total/4;
txtAvg.setText(""+average);
if(average>=75) {
txtResult.setText("Distinction");
txtGrade.setText("A");
}
else if(average>=60) {
txtResult.setText("First Class");
txtGrade.setText("B");
}
else if(average>=50) {
txtResult.setText("Second Class");
txtGrade.setText("C");
}
else if(average>=40) {
txtResult.setText("Average");
txtGrade.setText("D");
}
else {
txtResult.setText("Fail");
txtGrade.setText("F");
}
}
For Exit Button:
private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT SCREENSHOT

2-ELECTRONIC APPLIANCES.

DOCUMENTATION
Name of the project: ElectronicAppliances.java
The categories will be implemented in JRadioButton controls.
The discount will be calculated as follows:
COST DISCOUNT (%)
<=1000 5
Otherwise 10

The extra discount will be calculated as follows:


CATEGORY DISCOUNT
(%)
Electrical Appliance 3
Electrical Gadget 2
Stationary 1

• Calculate the total discount as: discount on cost+discount on category


• Calculate the discount amount as: cost*discount
Variable control names are as follows:-
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtCost
jTextField2 txtDisc
jButtonGroup1 ButtonGroup1
jRadioButton1 ApplianceRB
jRadioButton2 GadgetRB
jRadioButton3 StationaryRB
jButton1 DiscBTN
jButton2 ExitBTN

Questions:
• Using a JButton’s (Compute Discount) click event handler,
display the amount in a JTextField(txtDisc) control.

• Write the code for Exit button(ExitBTN) to exit the application.

Operating System used: Windows 10


Version of NetBeans used: 6.5.1

SCREENSHOT
CODING

For Compute Discount Button:


private void DiscBTNActionPerformed(java.awt.event.ActionEvent evt) {
int cost=0;
double discount=0;
cost=Integer.parseInt(txtCost.getText());
if(cost<=1000){
discount=0.05; //5%
}
else {
discount=0.10; //10%
}
if(ApplianceRB.isSelected())
{
discount=discount+0.03;//extra 3%
}
else if(GadgetRB.isSelected()){
discount=discount+0.02;//extra 2%
}

else if(StationaryRB.isSelected())
{
discount=discount+0.01;//extra 1%
}
txtDisc.setText(""+Math.round(cost*discount));
}

For Exit Button:


private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

3-SALES INCENTIVES.
DOCUMENTATION
Name of the project: SalesIncentives.java
Description of the project: Create a java desktop application to find the
Incentive(%) of Sales for a Sales person on the basis of following feedbacks:
Feedback Incentive (%)
Maximum Sales 10
Excellent Customer Feedback 8
Minimum Count of Customer 5

Note that the sales entry should not be spaced. Calculate the total
incentives as: Sales amount*incentive. The feedback will be implemented in
JCheckBox controls.

Variable control names are as follows:


CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtSales
jTextField2 txtInc
jButtonGroup1
jCheckBox1 Chk1
jCheckBox2 Chk2
jCheckBox3 Chk3
jButton1 IncBTN
jButton2 ExitBTN

Questions:
• Using a JButton’s (Compute Inceptives) click event handler, display
the total Incentives in a JTextField control.
• Write the code for Exit button to close the application.

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

For Compute Incentives Button:


private void IncBTNActionPerformed(java.awt.event.ActionEvent evt) {
int sales=0;
if(!txtSales.getText().trim().equals(""))
{
sales=Integer.parseInt(txtSales.getText().trim());
}
double incentive=0.0;
if(Chk1.isSelected())
{
incentive=incentive+0.1;//10%
}
else if(Chk2.isSelected()
{
incentive=incentive+0.08;//8%
}

else if(Chk3.isSelected())
{
incentive=incentive+0.05;//5%
}
txtInc.setText(""+Math.round(sales*incentive));
}
For Exit Button:
private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT SCREENSHOT

4-BIG BAZAR SHIPMENT.

DOCUMENTATION
Name of the project: BigBazarShipment.java

Description of the project: Mr. Sundaram with his family visited Big
Bazar Shopping mall. His family members purchased a variety of products
including garments. The total amount goes into some thousands. The
owner of the shopping mall provides handsome discounts of credit cards
such as:
Card Type Discount (%)
HDFC 12.0
ICICI 10.0
Visa 9.5
Axis 10.5
Standard Charted 8.5
City Bank 11.5
SBI 8.0
Variable control names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtAmount
jTextField2 txtDisc
jTextField3 txtNet
jRadioButton1 optHDFC
jRadioButton2 optICICI
jRadioButton3 optVisa
jRadioButton4 optAxis
jRadioButton5 optSC
jRadioButton6 optCity
jRadioButton7 optSBI
jButton1 DiscBTN
jButton2 ClearBTN
jButton3 ExitBTN
jButtonGroup1 ButtonGroup1

Questions:
• Write the code for Discount button to compute discount amount and
net amount.
• Write the code for ClearBTN command button to clear all the text
boxes and set the default choice in the radio button as SBI.
• Write the code for Exit button to close the application.

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1

SCREENSHOT
CODING

For Discount Button:


private void DiscBTNActionPerformed(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));
}

For Clear All Button:


private void ClearBTNActionPerformed(java.awt.event.ActionEvent evt) {
txtAmount.setText("");
txtDisc.setText("");
txtNet.setText("");
optSBI.setSelected(true);
}
For Exit Button:
private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT
5-APOLLO FAMILY CARE
HOSPITAL.

DOCUMENTATION
Name of the project: ApolloFamilyCareHospital.java
Description of the project: Apollo Family Care Hospital has
computerized its billing.
Variable control names are as follows: -
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtPNo
jTextField2 txtPName
jTextField3 txtDays
jTextField4 txtDCharge
jTextField5 txtOTCharge
jTextField6 txtMedicine
jTextField7 txtMeal
jTextField8 txtAdvance
jTextField9 txtSTotal
jTextField10 txtStay
jTextField11 txtTax
jTextField12 txtAmount
jRadioButton1 optD
jRadioButton2 optP
jRadioButton3 opts
jRadioButton4 optG
jButtonGroup1 JButtonGroup1
jButton1 BillBTN
jButton2 ClearBTN
jButton3 ExitBTN

Questions:
• When the form loads text boxes for subtotal(txtSTotal), Tax(TxtTax),
Amount to pay (txtAmount) and total stay charges (txtStay) are
disabled. Also Make the default category of service as General.
• When the user clicks clear button , Patient Number and Patient Name
should be set as blank, other text boxes should be set to zero. Also
make the default category of service as General.
• When the command button with caption “Calculate Bill” (BillBTN) is
clicked, subtotal, Tax (12% of subtotal), Total amount to be paid by
the patient are computed and displayed. The criterion for calculation
of subtotal charges is as given below:

Category of patient Stay Charges per day


Deluxe 4000.00
Private 2000.00
Semi Private 1000.00
General 400.00

• Total stay charges will be calculated as no of days * stay charges.


• Subtotal is calculated by adding total stay charges, Doctor charge, OT
charge, Medicine and Patient Meal.
• Tax is levied at 12% of subtotal.
• Advance deposit is entered by the user.
• Amount to pay = (Sub Total+ Tax)-Advance Deposit by the Patient.
• Write the code for Exit button to close the application.

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

txtSTotal.enable(false);
txtTax.enable(false);
txtAmount.enable(false);
txtStay.enable(false);
OptG.setSelected(true);
For Clear Button:
private void ClearBTNActionPerformed(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));
optG.setSelected(true);
}

For Calculate Bill button:


private void BillBTNActionPerformed(java.awt.event.ActionEvent evt) {
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;
TStayCharge=charge*days;
sTotal=TStayCharge+DCharge+OTCharge+MCharge+PMeal;
tax=sTotal*12/100;
AmtToPay=(sTotal+tax)-Advance;
txtSTotal.setText(String.valueOf(TStayCharge));
txtTax.setText(String.valueOf(tax));
txtAmount.setText(String.valueOf(AmtToPay));
}

OUTPUT SCREENSHOT
6-AMUSEMENT PARK.

DOCUMENTATION
Name of the project: AmusementPark.java
Description of the project: Amusement Park is a children park uses the
interface to generate a bill for its customers.
Variable control names are as follows:-
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtName
jTextField2 txtAge
jCheckBox1 Chkjr1
jCheckBox2 Chkjr2
jCheckBox3 Chkjr3
jCheckBox4 Chkjr4
jCheckBox5 Chkjr5
jTextArea1 txtRes
jButton1 BillBTN
jButton2 ExitBTN

When the Generate bill button is clicked the bill detail is displayed in a
JTextArea control.
Rate for each ride is given below:
Ride Rate(Rs)
Joy Ride 1 80
Joy Ride 2 50
Joy Ride 3 90
Joy Ride 4 100
Joy Ride 5 150

A customer can select more than one or both the joy rides. The total is
calculated as the sum of one or both joy rides cost. A discount of 25% is
given on each ride if the child is below 12 years. Write code under the
action event of the JButton1 and JButton2 to achieve the above
functionality.
Operating System Used: Windows 10
Version of NetBeans IDE: 6.5.1

SCREENSHOT

CODING

For Generate Bill Button:


private void BillBTNActionPerformed(java.awt.event.ActionEvent evt) {
String str=txtName.getText();
String nstr="";
int age=Integer.parseInt(txtAge.getText());
double bill=0;
txtRes.setText(null);
if(ChkJr1.isSelected()){
bill+=80;
nstr+="-"+chkJr1.getText();
}
if(ChkJr2.isSelected()){
bill+=50;
nstr+="-"+chkJr1.getText();
}
if(ChkJr3.isSelected()){
bill+=90;
nstr+="-"+chkJr1.getText();
}

if(ChkJr4.isSelected())
{
bill+=100;
nstr+="-"+chkJr1.getText();
}
if(ChkJr5.isSelected()){
bill+=150;
nstr+="-"+chkJr1.getText();
}
if(age<12)
bill=(bill*0.25);
txtRes.append("Name:"+str);
txtRes.append("\n Age:"+age);
txtRes.append("\n Your Rides:"+nstr);
txtRes.append("\n Bill amount:"+bill);
}
For Exit Button:
private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

7-GLAMOUR GARMENTS.

DOCUMENTATION
Name of the project: GlamourGarments.java
Mode Of Payment Discount
Cash 8%
Cheque 7%
Credit Card Nil
Description of the project: Glamour garments has developed a GUI
application for their company. The company accepts 3 modes cheques, cash
and credit cards. The discount is given as per mode of payment is as
follows:

If bill amount is more than 15000 then customer gets additional discount of
10% on bill amt.
List of controls of the form is as follows:
CONTROL TYPE CHANGED VARIABLE NAME
jTextField1 txtName
jTextField2 txtDisc
jTextField3 txtNetAmount
jTextField4 txtBillAmount
jComboBox1 cmbMode
jButton1 btnCalcDisc
jButton2 btnClear
jButton3 btnCalcNetAmt

Questions:
• Write code to make the textfields for Discount(txtDisc) and net
amount(txtNetAmount) uneditable.
• Write code to do the following:
• When “Calculate Discount” button is clicked the discount should
be calculated as per the given criteria and it should be displayed in
the discount textfield. “Calculate net amount”
button(btnCalcNetAmt) should also be enabled.
• When “Calculate Net Amount” button is clicked the net amount
should be calculated and it should be displayed in the net amount
text field.
Operating System Used: Windows 10
Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

For making txtDisc and txtNetAmt uneditable:


txtDisc.setEditable(false);
txtNetAmt.setEditable(false);
For Calculate Discount Button:
private void btnCalcDiscActionPerformed(java.awt.event.ActionEvent evt) {
float BillAmt,NetAmt,Disc;
String ModeofPayment;
BillAmt=Float.parseFloat(txtBillAmount.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>15000){
Disc=Disc+BillAmt*10/100;
}
btnCalcNetAmt.setEnabled(true);
txtDisc.setText(Disc+"");

For Calculate Net Amount Button:


private void btnCalcNetAmtActionPerformed(java.awt.event.ActionEvent
evt) {
float BillAmt,NetAmt,Disc;
BillAmt=Float.parseFloat(txtBillAmount.getText());
Disc=Float.parseFloat(txtDisc.getText());
NetAmt=BillAmt-Disc;
txtNetAmount.setText(""+NetAmt);

For Exit Button:


private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

For Clear Button:


private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {
txtName.setText("");
txtBillAmount.setText("");
txtDisc.setText("");
txtNetAmount.setText("");
}

OUTPUT SCREENSHOT
8-ALPHA BUILDERS.

DOCUMENTATION
Name of the project: AlphaBuilders.java
Description of the project: Ruchika a programmer at Alpha Builders. To
calculate wages to be paid to labourers. To develop following GUI in
NetBeans.
Male, Female membership respectively paid Rs. 140 per day and Rs.160 per
day. Skilled labourers are paid extra Rs.50 per day.
Variable control names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 NameTF
jTextField2 DaysTF
jTextField3 WagesTF
jRadioButton1 FemaleRB
jRadioButton2 MaleRB
jButtonGroup1 GenderBG
jCheckBox1 SkilledCB
jButton1 CalcWageBTN
jButton2 ClearBTN
jButton3 StopBTN

Questions:
• What should be done so that only one of the radio buttons (Male and
Female) can be selected at a time?
• Write the code to do the following:
• Calculate and display the total wage in the corresponding label
when the “Calculate Wages” button is pressed.
• Clear the name and no. of days worked text fields.
• Close the application when stop button is pressed.

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1

SCREENSHOT

CODING

For Selecting one radio button at a time:


Both the buttons should be put in buttongroup.
For Calculating Wages:
private void CalcWagesBTNActionPerformed(java.awt.event.ActionEvent
evt) {
int wageRate, NoOfDays, TotalPay;
if(MaleRB.isSelected())
{
wageRate=140;
}
else{
wageRate=160;
}
if(SkilledCB.isSelected())
{
wageRate+=50;
}
NoOfDays=Integer.parseInt(DaysTF.getText());
TotalPay=NoOfDays*wageRate;
WagesTF.setText(TotalPay+" ");
}

For ClearBTN:
private void ClearBTNActionPerformed(java.awt.event.ActionEvent evt) {
NameTF.setText("");
DaysTF.setText("")
For Stop Button:
private void StopBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0); }
OUTPUT SCREENSHOT

9-KIDDI LAND ENTERPRISES.

DOCUMENTATION
Name of the project: KiddiLandEnterprises.java
Description of the project: Mr. Ram Kishore, the owner of the Kiddi
Land Enterprises, has asked his programmer saumya to develop the
following GUI in NetBeans.
Mr. Ram accepts payment through three types of credit cards. The offer is
given according to the following scheme:
Type of Card Offer
Platinum 20% of amount
Gold 15% of amount
Silver 10% of amount
If the bill amount is more that Rs.25000/- , the customer gets an additional
offer of 5%.
Questions:
• To assign additional offer as zero(txtAddOffer) and Net Amount as
zero(txtNetAmt). Also set them as uneditable.
• [When “Calculate Offer”(btnCalcOffer) is clicked]
To calculate discount as per the given criteria and display the same in
Offer TextField.
To assign Additional offer(txtAddOffer) as 5% of amount(txtBillAmt)
as per the above condition.
To enable “Calculate Net Amount”(btnCalcNetAmt) button.
• [When “Calculate Net Amount” button is clicked].
To calculate Net Amount as[TotalCost(txtBillAmt) – Offer(txtOffer) -
Additional offer(txtAddOffer)]
To display the Net Amount in Net Amount TextField.

Variable control names are as follows:


CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtName
jTextField2 txtBillAmt
jTextField3 txtOffer
jTextField4 txtAddOffer
jTextField5 txtNet
jRadioButton1 RBPlatinum
jRadioButton2 RBGold
jRadioButton3 RBSilver
jButton1 btnCalcOffer
jButton2 btnCalcNetAmt
jButton3 btnExit

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

For Calculate Button:


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String product=ProductTF.getText();
int qty=Integer.parseInt(QtyTF.getText());
float rate=Float.parseFloat(RateTF.getText());
float amount=qty*rate;
AmtTF.setText(""+amount);
float disc;
if(PlatinumRB.isSelected())
{
disc=amount*20/100;
DiscTF.setText(""+disc);
}
else if(GoldRB.isSelected())
{
disc=amount*15/100;
DiscTF.setText(""+disc);
}
else
{
disc=amount*10/100;
DiscTF.setText(""+disc);
}
Float net=amount-disc;
NetTF.setText(""+Math.round(net));
}
For Exit Button:
private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT SCREENSHOT

10-DUCOM ENTERPRISES.

DOCUMENTATION

Name of the project: DucomEnterprises.java


Description of the project: Shekhar is a junior programmer at Ducom
Enterprises. He created the following GUI in NetBeans.
Variable control names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 BasicTF
jTextField2 HRATF
jTextField3 DATF
jTextField4 TaxTF
jTextField5 SalaryTF
jButton1 CalcSalaryBTN
jButton2 CalcTaxBTN
jButton3 ClearBTN

Questions:
• To calculate income tax to be paid and display it in textfield on the
click of command button. “Calculate income tax” as per the following
condition:
If the basic is less than 50000 then incomeTax=basic*0.2
And if greater or equal to 50000 then incomeTax=basic*0.3
• To calculate Salary and display it in textfield on the click of command
button “Calculate Salary”.
(Hint:Salary=(Basic+DearnessAllowance+HouseRentAllowance)-
IncomeTax
• To clear all the textfields on the click of command button “Clear”.

Operating System Used: Windows 8.1


Version of NetBeans IDE: 6.5.1

SCREENSHOT

CODING
For Calculate Income Tax Button:
private void CalcTaxBTNActionPerformed(java.awt.event.ActionEvent evt) {
String Name=NameTF.getText();
double basic=Double.parseDouble(BasicTF.getText());
double houserent=Double.parseDouble(HRATF.getText());
double dearnessallowance=Double.parseDouble(DATF.getText());
double incometax=0;
if(basic<5000){
incometax=basic*0.02;
}
else if(basic>5000){
incometax=basic*0.03;
}
TaxTF.setText(" "+incometax);
}
For Calculate Salary Button:
private void CalcSalaryBTNActionPerformed(java.awt.event.ActionEvent
evt) {
double basic=Double.parseDouble(BasicTF.getText());
double houserent=Double.parseDouble(HRATF.getText());
double dearnessallowance=Double.parseDouble(DATF.getText());
double incometax=0;
double totalsalary=(basic+houserent+dearnessallowance)-incometax;
SalaryTF.setText(" "+totalsalary);
}
For Clear Button:
private void ClearBTNActionPerformed(java.awt.event.ActionEvent evt) {
NameTF.setText("");
BasicTF.setText("");
HRATF.setText("");
DATF.setText("");
TaxTF.setText("");
SalaryTF.setText("");
}

OUTPUT SCREENSHOT

11-RECREATION PARK.
DOCUMENTATION

Name of the project: Recreationpark.java


Description of the project: Mr. Rangaswami works at Recreation Parkas
system analyst. He created the following GUI application. When a group
arise in recreation park the number of people in group whether they want
to enjoy to water park or not. Entry fee is Rs.500 per person the person can
choose to play at water park by selecting the checkbox. Rides at water park
will cost extra Rs. 250 per person.
Variable Controls names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 NOP
jTextField2 EF
jTextField3 WPC
jTextField4 TA
jCheckBox1 WaterParkCB
jButton1 ClearBTN
jButton2 CalcBTN
jButton3 ExitBTN

Questions:
• On the click of command button “Calculate”, textfield for “Entry Fees”
should display Entry fees per person*Number of people.
If “Water Park” CheckBox is selected, TextField for “WaterPark
charges” should display WaterPark charges per person*No. of people.
TextField for “Total Amount” should display sum of entry fees and
water park charges for all the people in the group
• Write java code to clear all TextBoxes on the click of “Clear” button.
• Write java code to close the application on the click of “Exit” button.
Operating System Used: Windows 10
Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

For Calculate Button:


private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
int np=Integer.parseInt(NOP.getText());
int entryfees=np*500;
EF.setText(""+entryfees);
int waterpark=0;
if(WaterParkCB.isSelected()==true)
waterpark=np*250;
WPC.setText(" "+waterpark);
int tamt=entryfees+waterpark;
TA.setText(" "+tamt);
}
For Clear Button:
private void ClearBTNActionPerformed(java.awt.event.ActionEvent evt) {
NOP.setText("");
EF.setText("");
WPC.setText("");
TA.setText("");
WaterParkCB.setEnabled(false);
}

For Exit Button:


private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0); }
OUTPUT SCREENSHOT

12-CLUB MAHINDRA.

DOCUMENTATION

Name of the project: ClubMahindra.java


Description of the project: Club Mahindra in Manali plans to go for
computerized in order to meet the workload in tourist season. Three Types
of rooms are available.
Variable Controls names are as follows:
CONTROL NAME: CHANGED VARIABLE NAME:
jTextField1 txtName
jTextField2 txtDays
jTextField3 txtFacilities
jTextField4 txtAmount
jTextField5 txtRate
jRadioButton1 OptSingle
jRadioButton2 OptDouble
jRadioButton3 OptDelux
jCheckBox1 chkTour
jCheckBox2 chkGym
jCheckBox3 chkLaundry
jButtonGroup1 RoomTypeBG
jButton1 CalcRateBTN
jButton2 CalcAmtBTN
jButton3 ClearBTN
Questions:
• Write the code to disable text boxes txtRate ,txtAmount, txtFacility when
the form is activated.
• Write the code for ClearBTN command button to lear all the text boxes.
• Write the code for CalcRateBTN to calculate rate of the room per day
and display it in the txtRate depending on the type of rooms selected by
the customer. Rate is calculated according to the following table:

ROOM TYPE: RATE PER DAY:


SINGLE 1500
DOUBLE 2800
DELUX 5000

• Write code for CalcAmtBTN to calculate the total amount and display it
in txtAmount. The total amount is calculated by the first finding the cost
of facilities selected by the customer. Cost of facilities is calculated
according to the following table:
FACILITY: COST:
TOUR PACAKAGE 7000
GYM 2000
LAUNDRY 1000

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1

SCREENSHOT
CODING

For Calculate Rate Button:


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
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));
}
}
For Calculate Amount Button:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
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));
}

For Exit Button:


private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

13-McDONALD’S INDIA.
DOCUMENTATION
Name of the project: McDonald’sIndia.java
Description of the project: McDonald’s India has computerized its
billing the outlet offers two different types of pizzas Regular and Pan pizzas.
The price of Regular is Rs. 120 and of Pan Rs. 160. The User can choose to
have three different types of extra toppings he wants. The extra topping
cost are:
TOPPING COST(Rs)
CHEESE 50
CAPSICUM 35
PEPPERONI 30

Variable Controls names are as follows:


CONTROL NAME CHANGED VARIABLE NAME
jTextField1 NameTF
jTextField2 QtyTF
jTextField3 RateTF
jTextField4 ToppingTF
jTextField5 AmountTF
jButtonGroup1 PizzaTypeBG
jRadioButton1 RegularRB
jRadioButton2 PanRB
jCheckBox1 CapCB
jCheckBox2 CheeseCB
jCheckBox3 PepCB
jButton1 RateBTN
jButton2 AmtBTN
jButton3 ExitBTN
jButton4 ClearBTN

Questions:
• Write the code for Calculate Rate button to calculate the rate of the
pizza and display it in RateTF depending on the type of pizza selected
by the customer.
• Write the code for the AmtBTN to calculate the total amount and
display it in AmountTF. The total amount is calculated by first finding
the cost of extra toppings selected by the customer. Remember that
each extra topping adds the value with previous topping. Then add it
to the rate and multiply the resultant amount by the quantity
ordered.
• Write the code for Clear button to clear all the textboxes a make
default to Regular Pizza type and Cheese as topping.
• Write the code for ExitBTN to exit the application.

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1

SCREENSHOT

CODING
For Calculate Rate Button:
private void RateBTNActionPerformed(java.awt.event.ActionEvent evt) {
double rate=0;
if(RegularRB.isSelected())
rate=120;
else if(PanRB.isSelected())
rate=160;
RateTF.setText(""+rate);
}
For Calculate Amount Button:
private void AmtBTNActionPerformed(java.awt.event.ActionEvent evt) {
double total=0,rate=0,toppcost=0,qty=0;
qty=Double.parseDouble(QtyTF.getText());
rate=Double.parseDouble(RateTF.getText());
if(CheeseCB.isSelected()==true){
toppcost=toppcost+50;
}
if(CapCB.isSelected()==true){
toppcost=toppcost+35;
}
if(PepCB.isSelected()==true){
toppcost=toppcost+30;
}
total=(rate+toppcost)*qty;
ToppingTF.setText(""+toppcost);
AmountTF.setText(""+total); }
For Clear Button:
private void ClearBTNActionPerformed(java.awt.event.ActionEvent evt) {
NameTF.setText("");
QtyTF.setText("");
RateTF.setText("");
ToppingTF.setText("");
AmountTF.setText("");
RegularRB.setSelected(false);
PanRB.setSelected(false);
CheeseCB.setSelected(false);
CapCB.setSelected(false);
PepCB.setSelected(false);
}
For Exit Button:
private void ExitBTNActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

14-HSBC BANK.

DOCUMENTATION
Name of the project: HSBCBank.java
Description of the project: HSBC Bank provides three type of loans- Car
loan, House loan, Education Loan.
Questions:
• Write the command to show the interest rate according to the
following criteria:
Car Loan – 10%
House Loan – 8.5%
Education Loan – 5%
• Calculate the discount on the amount according to the following
criteria:
• If amount > 10,000 and < 20,000 then 20% discount.
• If amount > 20,000 then 25% discount.
Variable Controls are as follows:

CONTROL NAME CHANGED VARIABLE NAME


jTextField1 txtLoanAmt
jTextField2 txtRate
jTextField3 txtDiscount
jRadioButton1 rbCarLoan
jRadioButton2 rbHouseLoan
jRadioButton3 rbEducationLoan
jButton1 InterestRateBTN
jButton2 CalcDiscountBTN
jButton3 ClearBTN
jButton4 ExitBTN

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

For Calculate Interest Rate:


private void IntrestRateBTNActionPerformed(java.awt.event.ActionEvent
evt) {
int LoanAmt=0;
LoanAmt = Integer.parseInt(txtLoanAmt.getText());
double Rate=0;
if(rbCarLoan.isSelected())
{
Rate=LoanAmt*0.10;
}
else if(rbHouseLoan.isSelected())
{
Rate=LoanAmt*0.85;
}
else if(rbEducationLoan.isSelected())
{
Rate=LoanAmt*0.05;
}
txtRate.setText(""+Rate);
}

For Calculate Discount Button:


private void CalcDiscountBTNActionPerformed(java.awt.event.ActionEvent
evt) {
int LoanAmt=0;
LoanAmt = Integer.parseInt(txtLoanAmt.getText());
double Discount=0;
if(LoanAmt>10000 && LoanAmt<20000)
Discount=LoanAmt*0.20;
else if(LoanAmt>20000)
Discount=LoanAmt*0.25;
txtDiscount.setText(""+Discount);
}
OUTPUT SCREENSHOT

15-GARMENT EXPORTING AND


HOUSING.
DOCUMENTATION
Name of the project: GarmentExportingandHousing.java
Description of the project: Mr. Karan Kamat, the owner of Garment
Exporting and Housing has asked her programmer Poonam to develop the
GUI in NetBeans.
Mr. Bansal accepts payment through 3 types of credit cards. The discount is
given according to the following scheme:
Type of card Discount
Platinum 20% of amount
Gold 15% of amount
Silver 10% of amount

If the Bill amount is more that Rs.25,000/- then the customer gets an
additional offer of 5%.
Questions:
• To assign Addition Discount as zero and Net Amount as Zero. Also set
then as un-editable.
• [When “Calculate Discount” button is clicked]
To calculate discount as per the given criteria and display the same.
To assign Additional Discount as 5% of amount as per the above
condition.
To enable “Calculate Net Amount” button.
• [When “Calculate Net Amount button is clicked]
To calculate net amount as:[TotalCost-Discount-Additional Discount]
To display the net amount.
Variable control names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtName
jTextField2 txtBA
jTextField3 txtDiscount
jTextField4 txtAD
jTextField5 txtnetAmount
jRadioButton1 RBPlatinum
jRadioButton2 RBSilver
jRadioButton3 RBGold
jButton1 btnCalcDisc
jButton2 btnCalcNetAmt
jButton3 btnExit

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING
For Calculate Discount Button:
private void btnCalcDiscActionPerformed(java.awt.event.ActionEvent evt) {
double BillAmount=Double.parseDouble(txtBA.getText());
double Discount=0;
if(RBPlatinum.isSelected()) {
Discount=BillAmount*20/100;
} else
if(RBSilver.isSelected()) {
Discount=BillAmount*15/100;
}
else
if(RBGold.isSelected()) {
Discount=BillAmount*10/100;
}
txtDiscount.setText(""+Discount);
double AdditionalDiscount=0;
if(BillAmount>25000)
{
AdditionalDiscount=(BillAmount*5/100);
}
txtAD.setText(" "+AdditionalDiscount);
}

For Calculate Net Amount Button:

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


double BillAmount=Double.parseDouble(txtBA.getText());
double Discount=Double.parseDouble(txtDiscount.getText());
double AdditionalDiscount=Double.parseDouble(txtAD.getText());
double netAmount=0;
netAmount=BillAmount-Discount-AdditionalDiscount;
txtnetAmount.setText(""+netAmount);
}

OUTPUT SCREENSHOT
16- MAXWELL PUBLIC SCHOOL

DOCUMENTATION

Name of the project: MaxewellPublicSchool.java

Description of the project: Maxewell Public School wants to


computerized the employee salary section. The school has two categories
of employees: Teaching and Non-Teaching. The teaching employees are
further categories into PGTs, TGTs and PRTs having different basic salary.
The school gives addition pay of 3000 for employees who are working more
than 10 years.

Employee Basic Salary DA HRA Deductions


Type (% of Basic (% of Basic (% of Basic (% of Basic
Sal) Sal) Sal) Sal)
Non Teaching 12500 31 30 12
PGT 14500 30 30 12
TGT 12500 21 30 12
PRT 11500 20 25 12
Variable Controls names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtBasic
jTextField2 txtDed
jTextField3 txtGross
jTextField4 txtNet
jButtonGroup1 JButtonGroup1
jRadioButton1 optNon
jRadioButton2 optPgt
jRadioButton3 optTgt
jRadioButton4 optPrt
jCheckBox1 chk10Year
jButton1 CalcBTN
jButton2 ClearBTN
jButton3 ExitBTN

Questions:
• Write the code to calculate the basic salary, deductions, gross salary
and net salary based on the given specification.
Add 3000 to net salary if employee is working for more than 10 years.
Gross Salary = Basic Salary + DA + HRA
Net Salary = Gross Salary – deductions
• Write the code to clear all the TextFields, uncheck Checkboxes and
set Non-Teaching as the default category.
• Write the code to Exit the application.
Note: To operate the application, select the employee category and click the
calculate button.

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

For Calculate Button:


private void CalcBTNActionPerformed(java.awt.event.ActionEvent evt) {
float BasicSalary =0, Da =0, Hra =0, Deduction;
float GrossSalary, NetSalary;
if(chk10Year.isSelected())
BasicSalary += 3000;
if(optNon.isSelected()){
BasicSalary += 12500;
Da = BasicSalary * (float)0.31;
Hra = BasicSalary * (float)0.30;
}
else if(optPgt.isSelected()){
BasicSalary += 14500;
Da = BasicSalary * (float)0.21;
Hra = BasicSalary * (float)0.30;
}
else if(optTgt.isSelected()){
BasicSalary += 12500;
Da = BasicSalary * (float)0.21;
Hra = BasicSalary * (float)0.30;
}
else if(optPrt.isSelected()){
BasicSalary += 11500;
Da = BasicSalary * (float)0.2;
Hra = BasicSalary * (float)0.25;
}
Deduction = BasicSalary * (float)0.12;
GrossSalary = BasicSalary + Da + Hra;
NetSalary = GrossSalary - Deduction;
txtBasic.setText(String.valueOf(BasicSalary));
txtDed.setText(String.valueOf(Deduction));
txtGross.setText(String.valueOf(GrossSalary));
txtNet.setText(String.valueOf(NetSalary));
For Clear Button:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
txtBasic.setText("");
txtGross.setText("");
txtNet.setText("");
txtDed.setText("");
chk10Year.setSelected(false);
For Exit Button:
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT SCREENSHOT

18-CLASS CONCEPT
DOCUMENTATION

Name of Project: ClassConcept.java


Description of the project: Create a java Desktop Application to
demonstrate class concepts. Using class Cube, develop the application to
find the volume of a cube.
Variable Controls are as follows: -
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtLength
jTextField2 txtBreadth
jTextField3 txtHeight
jTextField4 txtVolume
jButton1 BTNVolume
jButton2 BTNExit

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1

SCREENSHOT
CODING

@SuppressWarnings("unchecked")
public class Cube{
int length;
int breadth;
int height;
public Cube(){
}
public int getVolume(){
return(length*breadth*height);
For Volume Button:
private void BTNVolumeActionPerformed(java.awt.event.ActionEvent evt) {
int l,b,h;
float volume;
Cube cubeObj=new Cube();
l=Integer.parseInt(txtLength.getText());
b=Integer.parseInt(txtBreadth.getText());
h=Integer.parseInt(txtHeight.getText());
cubeObj.length=l;
cubeObj.breadth=b;
cubeObj.height=h;
volume=cubeObj.getVolume();
txtVolume.setText(""+volume);}

For Exit Button:


private void BTNExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

18-CONSTRUCTOR IN A CLASS.
DOCUMENTATION
Name of the project: ConstructorinaClass.java
Description of the project: Create a Java Desktop Application to
Demonstrate constructor object for the following data members of
Teacher Class:
private String name;
private String address;
private String desig;
private double salary;
private double da;
private double hra;
private double gross;
The program should initialize the data members through a
constructor and using a Display method of a Teacher class, show the
details in a JTextArea control.
Variable Controls are as follows:
CONTROL NAME CHANGED VARIABLE NAME
Button BTNTeacher
Button BTNExit

Operating System used: Windows 10


Version of NetBeans used: 6.5.1

SCREENSHOT

CODING

@SuppressWarnings("unchecked")
class Teacher
{
private String name;
private String address;
private String desig;
private double salary;
private double da;
private double hra;
private double gross;
Teacher()
{
name="Mr. Ratan Singh";
address="B-150,Sec-5,Saket,New Delhi";
desig="PGT Chemistry";
salary=8450.00;
da=6200.00;
hra=3200.00;
gross=0.0;
}
void display()
{
jTextArea1.append("Teacher Information"+"\n");
jTextArea1.append("----------------------------"+"\n");
jTextArea1.append("Name:"+name+"\n");
jTextArea1.append("Address:"+address+"\n");
jTextArea1.append("Designation:"+desig+"\n");
jTextArea1.append("Basic salary:"+salary+"\n");
jTextArea1.append("Dearness allowance:"+da+"\n");
jTextArea1.append("House rent allowance"+hra+"\n");
gross=salary=da=hra;
jTextArea1.append("Gross salary:"+gross);
}
}
For Show Teacher Data Button:
private void BTNTeacherActionPerformed(java.awt.event.ActionEvent evt) {
Teacher teach = new Teacher();
teach.display();
}
For Exit Button:
private void BTNExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT SCREENSHOT

19-RECTANGLE CLASS.

DOCUMENTATION
Name of the project: RectangleClass.java
Description of the project: Create a java desktop application using class
to implement the following for a Rectangle class:
• Calculate area of rectangle.
• Calculate perimeter of rectangle.
The Rectangle class has following declaration:
public class rectangle
{
int length;
int breadth;
public rectangle()
{
length=breadth=0;
}
int area(int L,int B)
{
length=L;
breadth=B;
return(length*breadth);
}
int perimeter(int L,int B)
{
length=L;
breadth=B;
return(2*(length+breadth));
}
}
Variable Controls names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
TextFields txtLength
TextFields txtBreadth
TextFields txtResult
RadioButton AreaRB
RadioButton PerimeterRB
Button BTNCalc
Button BTNExit

Operating System Used: Windows 8


Version of NetBeans IDE: 6.5.1

SCREENSHOT

CODING

@ Supress Warnings (“unchecked”):


public class rectangle{
int length;
int breadth;
public rectangle(){
length=0;
breadth=0;
}
int area(int L,int B){
length=L;
breadth=B;
return(length*breadth);
}
int perimeter(int L,int B){
length=L;
breadth=B;
return(2*(length+breadth));
}
}
For Calculate Button:
private void BTNCalcActionPerformed(java.awt.event.ActionEvent evt) {
int L,B;
int result=0;
L=Integer.parseInt(txtLength.getText());
B=Integer.parseInt(txtBreadth.getText());
rectangle RecObj=new rectangle();
if(AreaRB.isSelected())
{
result=RecObj.area(L,B);
}
else
if(PerimeterRB.isSelected()){
result=RecObj.perimeter(L,B);
}
txtResult.setText(Integer.toString(result));
}
For Exit Button:
private void BTNExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

20-CLASS EMPLOYEE.
DOCUMENTATION
Name of the project: ClassEmployee.java
Description of the project: Define a Class Employee having the
following description:
Data Members:
String pan: to store personal account number.
String name:- to store name.
double taxincome:- to store annual taxable income
double tax:- to store tax that is calculated.
Member Functions:
Input (): Store the pan number, name, taxincome
Calc() : Calculate tax for an employee
Write a program to compute the tax according to the given
conditions and display output as per given format:
TOTAL ANNUAL TAXABLE INCOME TAX RATE
Upto Rs.1,00,000 No tax
From Rs.1,00,000 to Rs.1,50,000 10% of the income exceeding
Rs.1,00,000
From Rs.1,50,000 to Rs.2,50,000 Rs.5000+20% of the income
exceeding Rs.1,50,000
Above Rs.2,50,000 Rs.25,000+30% of the income
exceeding Rs.2,50,000
Display individual employee information.
Using a JButton’s(Calculate Tax) click event handler, display the net tax in a
JTextField control. To calculate the tax.

Variable Controls names are as follows:


CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtPan
jTextField2 txtName
jTextField3 txtIncome
jTextField4 txtTax
jButton1 BTNTax
jButton2 BTNExit
Questions:
• Write the code to declare the Employee class and its required
methods.
• Write the code for Calculate Tax button to call class objects for tax
calculation.
• Write the code to terminate the application.

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1
SCREENSHOT

CODING

@SuppressWarnings("unchecked")
class Employee{
String pan;
String name;
double taxincome;
double tax;
void Employee()
{
pan=" ";
name=" ";
taxincome=0;
tax=0;
}
void input()
{
pan=txtPan.getText();
name=txtName.getText();
taxincome=Double.parseDouble(txtIncome.getText());
}
double calc()
{
if(taxincome<=100000)
tax=0.0;
else if(taxincome<=150000)
tax=(10.0/100)*(taxincome-100000);
else if (taxincome<=250000)
tax=5000+(20.0/100)*(taxincome-150000);
else if (taxincome>250000)
tax=25000+(30.0/100)*(taxincome-250000);
return tax;
}
}
For Calculate Tax Button:
private void BTNTaxActionPerformed(java.awt.event.ActionEvent evt) {
Employee emp=new Employee();
emp.input();
double TTax=emp.calc();
txtTax.setText(Double.toString(TTax));
}
For Exit Button:
private void BTNExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

21-CLASS RESORT.

DOCUMENTATION
Name of the project: Class Resort.java
Description of the project: Define a class Resort in Java with the
following description:
Private Members:
Room_no-To store room number
Name-To store customer name
Charges-To store per day charges
Days-To store total amount
Amount-To store total amount
Compute()-A function to calculate and return amount.
if((Days*Charges)>10000)(Amount=(Days*Charges)-
(Days*charges*(float)0.1) else Amount = Days*Charges
Public Members:
A constructure to initialize the data member as: Room_no=0,Name= "x",
Charges=0 and Amount=0.
getInfo()-A function to enter the content as Room number,Name, Charges &
Days.
display()-A function to display Room number,Name ,Charges,Days and
Amount in a text area.
(Amount to be displayed by calling function compute ()) through
dispinfo( function).

Variable Controls names are as follows:


CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtRoom
jTextField2 txtCust
jTextField3 txtCharge
jTextField4 txtDays
jTextArea1
jButton1 btnDisplay
jButton2 btnExit

Questions:
(a) Declare the class and its member function to perform the resort
objectives.
(b) Write the code for Display Details button to call the class objects.
Operating System used : Windows 10
Version of NetBeans used : 6.5.1
SCREENSHOT

CODING

@SuppressWarnings("unchecked")
class Resort{
private int Room_no;
private String Name;
private int Days;
private float Charges;
private float Amount;
Resort(){
Room_no = 0;
Name = "x";
Charges = 0;
Days = 0;
Amount = 0;
}
float Compute(){
if(Days*Charges>10000)
Amount = (Days*Charges)-(Days*Charges*(float)0.1);
else
Amount = Days*Charges;
return Amount;
}
public void getInfo(){
Room_no = Integer.parseInt(txtRoom.getText());
Name = txtCust.getText();
Charges = Integer.parseInt(txtRoom.getText());
Name = txtCust.getText();
Charges = Float.parseFloat(txtDays.getText());
}
public void dispInfo(){
jTextArea1.setText("");
jTextArea1.append("Room No.:"+Room_no + "\n");
jTextArea1.append("Name:"+Name+"\n");
jTextArea1.append("Charges/Day:"+Charges+"\n");
jTextArea1.append("No. of days:"+Days+"\n");
jTextArea1.append("Total Amount:"+Compute()+"\n");
}
}
For Display Details Button:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Resort R = new Resort();
R.getInfo();
R.dispInfo();
}

OUTPUT SCREENSHOT

22-CLASS TRAVEL PLAN

DOCUMENTATION
Name of the project: ClassTravelPlan.java
Description of the project: Define a class Travel Plan in java with
following specification:
Private Members:
• Plain_code-Long type
• Place-String type
• No_of_travelers-integer type
• No_of_bus-integer type
Public members:
• A constructor to assign initial values of Plan_code as 'delhi',No. of
travelers as 5, No. of busses as 1.
• A function newPlan() which allows used to enter Plan Code, Place and
No. of travelers and No. of busses as following condition:
Number Of Travellers Number of Buses
Less than 20 1
Equal to and more than 20 and less than 40 2
Equal to and more than 40 3

• A function showPlan() to display the content of all the data members.

Variable control names are as follows:

CONTROL NAME CHANGED VARIABLE NAME


jTextField1 txtPlain
jTextField2 txtPlace
jTextField3 txtNotrav
jTextField4 txtBus
jButton1 btnShow

Operating System used: Windows 10


Version of NetBeans used: 6.5.1
SCREENSHOT

CODING

@SuppressWarnings("unchecked")
class TravelPlan{
private long Plain_Code;
String Place;
int No_Of_Travelers,No_Of_Bus;
public TravelPlan(){
Plain_Code=101;
Place="Bhopal";
No_Of_Travelers=5;
No_Of_Bus=1;
}
public void newPlan(){
Plain_Code=Integer.parseInt(txtPlain.getText());
Place=txtPlace.getText();
No_Of_Travelers=Integer.parseInt(txtNotrav.getText());
if (No_Of_Travelers<20)
No_Of_Bus=1;
else if (No_Of_Travelers>=20&&No_Of_Travelers<40)
No_Of_Bus=2;
else if (No_Of_Travelers>=40)
No_Of_Bus=3;
txtBus.setText(""+ No_Of_Bus);
}
}
For Show Button:
private void btnShowActionPerformed(java.awt.event.ActionEvent evt) {
TravelPlan t=new TravelPlan();
t.newPlan();
}

OUTPUT SCREENSHOT
23-SUNRISE TOURISM.

DOCUMENTATION
Name of the project: SunriseTourism.java
Description of the project: Sunrise tourism in Goa provides a facility to
the visitor for renting motor bikes on per day basis. The tourism industry
developed an interface form in NetBeans.
Variable control names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtBikeno
jTextField2 txtName
jTextField3 txtPhone
jTextField4 txtDays
jButton1 btnCharge
jButton2 btnExit

The programmer of the company handles the system by using a class called
MBike with the following specifications:
Instance Variables/data Members:
• String Bikeno-To store the bike’s number
• String Name-to store the name of the customer
• String Phno-To store the phone number of the customer
• int Days-to store total no. of days the bike rented
• float Charge-To calculate and store the rental charge
Member Methods:
• voidAccept_Data()-To input and store details of the customer
• voidDisplay_Data()-To display all information in a TextArea
• void_Compute_Data()-To compute the rental charge which will be
invoked in Display_Data method

The rent for a mobike is charged on the following basis:


• First Five days-Rs.300 per day
• Next Five days-Rs.200 per day
• Rest of days-Rs.100 per day
Questions:
• Declare the class and its member function to perform the tourism
objectives.
• Write the code for the Calculate Charge button to call the class
objects and display the details in the jTextArea.

Operating System used: Windows 10


Version of NetBeans used: 6.5.1

SCREENSHOT
CODING

@SuppressWarnings("unchecked")
class MBike{
int Days;
String BikeNo,Name,Phno;
float Charges;
float Compute(){
if(Days<=5)
Charges=(Days*300);
else if(Days>5&&Days<+10)
Charges=1500+(Days-5)*200;
else
Charges=2500+(Days-10)*100;
return Charges;
}
public void Accept_Data(){
BikeNo=txtBike.getText();
Name=txtName.getText();
Phno=txtPhone.getText();
Days=Integer.parseInt(txtDays.getText());
}
public void Display_Data(){
Charges=Compute();
txtArea.setText("");
txtArea.append("Bike No.:"+BikeNo+"\n");
txtArea.append("Name:"+Name+"\n");
txtArea.append("Phone No.:"+Phno+"\n");
txtArea.append("No.Of Days:"+Days+"\n");
txtArea.append("Charges/day:"+Charges+"\n");
}
}
For Button Calculate Charge:
private void btnCalcChargeActionPerformed(java.awt.event.ActionEvent
evt) {
MBike B=new MBike();
B.Accept_Data();
B.Display_Data();
}

OUTPUT SCREENSHOT
24-FACTORIAL USING CLASS
INHERITANCE.

DOCUMENTATION
Name of the project: FactorialusingclassInheritance.java
Description of the project: Demonstrate the inheritance concepts
in Java using NetBeans IDE. Calculate the factorial of a number using
childClass and baseClass.
Variable Controls names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtFactorial
jTextField2 txtNum
jButton1 BTNFactorial
jButton2 BTNExit

Operating System used : Windows 10


Version of NetBeans used: 6.5.1

SCREENSHOT

CODING
@SuppressWarnings("unchecked")
class baseClass
{
int counter;
baseClass()
{
counter=0;
}
public void factorial()
{
int i;
double fact=1.0;
for (i = 1; i<= counter; i++)
fact=fact*i;
txtFact.setText(Double.toString(fact));
}
}
class childClass extends baseClass
{
private int counter;
void changeVal(int n)
{
counter =n;
}
}
For Factorial Button:
private void btnFactActionPerformed(java.awt.event.ActionEvent evt) {
int N;
N=Integer.parseInt(txtNum.getText());
childClass obj1=new childClass();
obj1.changeVal(N);
obj1.factorial();
}
For Exit Button:
private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

25-METHOD OVERLOADING.
DOCUMENTATION
Name of the project: MethodOverloading.java
Description of the project: Create a Java Desktop application to
perform the method overloading concepts without using class.
Variable Controls names are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 TF1
jTextField2 TF2
jTextField3 TF3
jButton1 BTNShow
jButton2 BTNExit

Operating System used: Windows 10


Version of NetBeans used: 6.5.1

SCREENSHOT

CODING

@SuppressWarnings("unchecked")
void show(int roll){
TF1.setText(Integer.toString(roll));
}
void show(double fees){
TF2.setText(Double.toString(fees));
}
void show(String name){
TF3.setText(name);
}
For Show Me Button:
private void BTNShowActionPerformed(java.awt.event.ActionEvent
evt) {
show(100);
show(12000.333);
show("Mr.Sidharth Malhotra");
}
For Exit Button:
private void BTNExitActionPerformed(java.awt.event.ActionEvent evt)
{
System.exit(0);
}

OUTPUT SCREENSHOT
26-METHOD OVERRIDING.

DOCUMENTATION
Name of the project: MethodOverRiding.java
Description of the project: Develop a Java desktop application to find
the area of a circle and cylinder using java overriding method.
Variable Controls are as follows:
CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtR
jTextField2 txtL
jTextField3 txtCircle
jTextField4 txtCylinder
jButton1 BTNOver
jButton2 BTNExit

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1

SCREENSHOT

CODING
@SuppressWarnings("unchecked")
class Circle {
protected double radius;
public Circle(double radius) {
this.radius = radius;
}
public double getArea() {
return Math.PI*radius*radius;
}
}
class Cylinder extends Circle {
protected double length;
public Cylinder(double radius, double length) {
super(radius);
this.length = length;
}
@Override
public double getArea() {
return 2*super.getArea()+2*Math.PI*radius*length;
}
}
For OverRide Button:
private void BTNOverActionPerformed(java.awt.event.ActionEvent evt) {
double rad,len;
double AreaC, AreaCy;
rad=Double.parseDouble(txtR.getText());
len=Double.parseDouble(txtL.getText());
Circle cir=new Circle(rad);
Cylinder cyl=new Cylinder(rad,len);
AreaC=cir.getArea();
AreaCy=cyl.getArea();
txtCircle.setText(Double.toString(AreaC));
txtCylinder.setText(Double.toString(AreaCy));
}
For Exit Button:
private void BTNExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

OUTPUT SCREENSHOT

28-TEACHER TABLE
DOCUMENTATION
Name of the project: TeacherTable.java
Description of the project: Create a Java Desktop application to view
TEACHER table data using jTable control. Using JDBC connection steps, view
data in tabular form. The Teacher table in MySQL school database with the
following structure and data:
FIELD NAME MySQL DATA TYPE LENGTH
TNO Char 4
TNAME Varchar 25
TADDRESS Varchar 25
SALARY Float
DEPT_NO Char 4
DOJ Date

The table has the following records:


TNO TNAME TADDRESS SALARY DEPTNO DOJ
T01 Rakesh Sharma 245-Malviya Nagar 25600 D05 2001-12-12
T02 Jugal Mittal 34,Ramesh Nagar 22000 D02 1999-07-03
T03 Sharmila Kaur D-31 Ashok Vihar 21000 D01 2000-06-06
T04 Sandeep Kaushik MG-32,Shalimar Bagh 15000 D03 2001-08-08
T05 Sangeeta Vats G-35,Malviya Nagar 18900 D05 2000-02-20
T06 Ramesh Kumar BG-42,Shalimar Bagh 24000 D03 1997-07-03
T07 Shyam Arora 50,MIG FLATS,Rohini 12000 D02 1998-08-15
T08 Shiv Om R-44,Kirti Nagar 13000 D02 2001-09-22
T09 Vivek Rawat E-33/27,Sec-1,Rohini 17000 D01 2001-10-12
T10 Rajesh Verma D-11/130,Sec-5,Dwarka 15600 D04 2000-11-07
T11 Ashok Singhal F-1/65,East Patel Ngr 17500 D02 1999-08-11
T12 Chetan Shukla C-105,10th Cross 13400 D02 2001-06-13
T13 Reena Mehta 120,DDA Colony 15500 D02 2000-07-18
T14 Bhawana Lamba E-140,Swastik Apptt.,DLF 14500 D04 2001-07-16
T15 Jagjit Singh A-24D,Printers Apptt. 16500 D04 1898-07-11

Variable Controls Are As follows:


CONTROL NAME CHANGED VARIABLE NAME
Button BTNDisplay/Query
Button BTNExit

Operating System used: Windows 10


Version of NetBeans used: NetBeans IDE 6.5.2
SCREENSHOT

CODING

For Display Button:


private void btnDISPLAYActionPerformed(java.awt.event.ActionEvent evt) {
DefaultTableModel model=(DefaultTableModel)table.getModel();
String query="SELECT*FROM TEACHER";
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/jns","root","");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next()){
String ntNo=rs.getString("tno");
String ntName=rs.getString("tname");
String ntAddress=rs.getString("taddress");
String nSalary=rs.getString("salary");
String ndept_no=rs.getString("dept_no");
String ndoj=rs.getString("doj");
model.addRow(new Object[]
{ntNo,ntName,ntAddress,nSalary,ndept_no,ndoj});
}
}
catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
}

For Exit Button:


private void btnEXITActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT SCREENSHOT

28-INSERTING DATABASE
RECORDS
DOCUMENTATION

Name of the project: InsertingDatabaseRecords.java


Description of the project: Create an application to insert new records
into MySQL TEACHER table contains following structure:
Field Name MySQL Data Type Length
TNO Char 4

TNAME Varchar 25
TADDRESS Float 25
SALARY Float
DEPT_NO Char 4
DOJ Date

Variable Controls are as Follows:


CONTROL NAME CHANGED VARIABLE NAME
jTextField1 txtTNo
jTextField2 txtTName
jTextField3 txtTAddress
jTextField4 txtTSalary
jTextField5 txtTDeptno
jTextField6 txtTDOJ
jButton1 BTNMFirst
jButton2 BTNNext
jButton3 BTNPrev
jButton4 BTNLast
jButton5 BTNSave
jButton6 BTNClear
jButton7 BTNExit

Operating System Used: Windows 10


Version of NetBeans IDE: 6.5.1

SCREENSHOT

CODING

@SuppressWarnings("unchecked")
Statement stmt=null;
ResultSet rs=null;
String Sql="SELECT * FROM TEACHER";
For Move First Button:
private void btnFirstActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/jns","root","");
stmt=con.createStatement();
rs=stmt.executeQuery(Sql);
rs.first();
String tcode=rs.getString("tno");
String name=rs.getString("tname");
String add=rs.getString("taddress");
String sal=rs.getString("salary");
String dept=rs.getString("dept_no");
String tdoj=rs.getString("doj");
txtTno.setText(tcode);
txtName.setText(name);
txtAdd.setText(add);
txtSalary.setText(sal);
txtDeptno.setText(dept);
txtDoj.setText(tdoj);
btnPre.setEnabled(false);
btnLast.setEnabled(true);
btnNext.setEnabled(true);
}catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
}
}
For Move Next Button:
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/jns","root","");
if(rs.next()) {
String tcode=rs.getString("tno");
String name=rs.getString("tname");
String add=rs.getString("taddress");
String sal=rs.getString("salary");
String dept=rs.getString("dept_no");
String tdoj=rs.getString("doj");
txtTno.setText(tcode);
txtName.setText(name);
txtAdd.setText(add);
txtSalary.setText(sal);
txtDeptno.setText(dept);
txtDoj.setText(tdoj);
btnFirst.setEnabled(false);
btnPre.setEnabled(true);
btnLast.setEnabled(true);
}else{
JOptionPane.showMessageDialog(this,"You are at last record
position","TEACHER",0);
}
}
catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
}
}
For Move Previous Button:
private void btnPreActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/jns","root","");
if(rs.previous()) {
String tcode=rs.getString("tno");
String name=rs.getString("tname");
String add=rs.getString("taddress");
String sal=rs.getString("salary");
String dept=rs.getString("dept_no");
String tdoj=rs.getString("doj");
txtTno.setText(tcode);
txtName.setText(name);
txtAdd.setText(add);
txtSalary.setText(sal);
txtDeptno.setText(dept);
txtDoj.setText(tdoj);
btnFirst.setEnabled(false);
btnNext.setEnabled(true);
btnLast.setEnabled(true);
}else{
JOptionPane.showMessageDialog(this,"You are at last record
position","TEACHER",0);
}
}
catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
}
}
For Move Last Button:
private void btnLastActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/jns","root","");
stmt=con.createStatement();
rs=stmt.executeQuery(Sql);
rs.last();
String tcode=rs.getString("tno");
String name=rs.getString("tname");
String add=rs.getString("taddress");
String sal=rs.getString("salary");
String dept=rs.getString("dept_no");
String tdoj=rs.getString("doj");
txtTno.setText(tcode);
txtName.setText(name);
txtAdd.setText(add);
txtSalary.setText(sal);
txtDeptno.setText(dept);
txtDoj.setText(tdoj);
btnFirst.setEnabled(false);
btnNext.setEnabled(true);
btnPre.setEnabled(true);
}catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
}
}
For Clear Name Button:
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {
txtTno.setText("");
txtName.setText("");
txtAdd.setText("");
txtSalary.setText("");
txtDeptno.setText("");
txtDoj.setText("");
}
For Save Button:
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/jns","root","");
stmt=con.createStatement();
rs=stmt.executeQuery(Sql);
/* while (rs.next()){
System.out.println(rs.getString("name"+":"+rs.getString("taddress")));
}*/
String tcode= txtTno.getText();
String name= txtName.getText();
String add= txtAdd.getText();
double sal=Double.parseDouble( txtSalary.getText());
String dept=txtDeptno.getText();
String tdoj= txtDoj.getText();
String strSQL="INSERT INTO
TEACHER(tno,tname,taddress,salary,dept_no,doj) VALUES ('"+(tcode)+"','"+
(name)+"','"+(add)+"',"+(sal)+",'"+(dept)+"','"+(tdoj)+"')";
System.out.print("Insert new record:");
int rowsEffected=stmt.executeUpdate(strSQL);
System.out.println(rowsEffected + "rows effected");
} catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
}
}
For Exit Button:
private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT SCREENSHOT
Mysql SECTION-B

1-HOSPITAL TABLE.

Queries:
• To select all the information of patients of cardiology department.
SELECT *
FROM HOSPITAL
WHERE Department=’Cardiology’;

• To list the names of all female patients who are in ENT department.
SELECT Name
FROM HOSPITAL
WHERE Department=’ENT’;

• To list the names of all patients with their date of admission in


ascending order.
SELECT Name
FROM HOSPITAL
ORDER BY Dateofadm;

• To display Patient’s Name, charges & age for only female Patients.
SELECT Name,Charges,Age
FROM HOSPITAL
WHERE Sex=’F’;
(e) To count number of patients with age < 30.
SELECT COUNT(*)
FROM HOSPITAL
WHERE Age<30;
(f) To insert a new row in the HOSPITAL table with the following data:
11,’Aftab’,24,’Surgery’,’2008-02-25’,1300,’M’
INSERT INTO HOSPITAL VALUES
(11,’Aftab’,24,’Surgery’,’2008-02-25’,1300,’M’);

(g) To display the total number of departments.


SELECT COUNT(DISTINCT Department)
FROM HOSPITAL;

(h) To display the department-wise maximum charges.


SELECT Department,MAX(Charges)
FROM HOSPITAL
GROUP BY Department;
• Give the output of the following SQL queries:
• SELECT COUNT(DISTINCT Charges) FROM HOSPITAL;

• SELECT MIN(Age)
FROM HOSPITAL
WHERE Sex=”F”;

• SELECT SUM(Charges)
FROM HOSPITAL
WHERE Department=”ENT”;

• SELECT AVG(Charges)
FROM HOSPITAL
WHERE Dateofadm<”1998-02-12”;
2-COURSE TABLE.

Queries:
• To show all the information about the students of all the history
department.
SELECT *
FROM COURSE
WHERE Department=’History’;

• To list all name of female students who are in the Hindi


department.
SELECT Name
FROM COURSE
WHERE Department=’Hindi’ and Sex = 'F';
• To list the names of female students with their date of admission in
ascending order.
SELECT Name
FROM COURSE
ORDER BY Dateofadm;
• To display student's Name,Charges,Age for male students only.
SELECT Name,Fees,Age
FROM COURSE
WHERE Sex=’M’;
• To count the number of students with age>15.
SELECT COUNT(*)
FROM COURSE
WHERE Age<15;
• To insert a new row in the table with the following data:
INSERT INTO HOSPITAL VALUES
(9,’Zaheer’,15,’Computer’,’2013-03-12’,230,’M’);
• To find total number of departments in the table.
SELECT COUNT(DISTINCT Department)
FROM COURSE;
• To list the maximum fees for each department.
SELECT Department,MAX(Fees)
FROM COURSE
GROUP BY Department;

• Give the output of the following SQL queries:


SELECT COUNT(DISTINCT DEPARTMENT)
FROM COURSE;

3-TOY_SHOPPE TABLE.

Queries:
• Display the names of all those toys, which are for two players.
SELECT Category,Toy_name
FROM Toy_Shoppe
WHERE Category=’Two Players’;
• Display the names of toys and their price having quantity more than 20.
SELECT Toy_name,Price
FROM Toy_Shoppe
WHERE Quantity>20;
• To display the list of all those toys with Starting_ Age >2 in descending order
of Price.
SELECT *
FROM Toy_Shoppe
WHERE Starting_Age>2
ORDER BY Price desc;
• To display the report with Toy_name , Category ,Price for only those toys for
which Starting_Age is above 1 and Ending_Age is below 9.
SELECT Toy_name,Category,Price
FROM Toy_Shoppe
WHERE Starting_Age>1 And Ending_Age<9;
• To insert a new item in the existing table with the following data:
7,’Jerry’,’Stuff Toy’,600,15,1,6
INSERT INTO Toy_Shoppe VALUES
(7,’Jerry’,’Stuff Toy’,600,15,1,6);
• Display the maximum prize of toy.
SELECT MAX(Price)
FROM Toy_Shoppe;
• To display category wise maximum price.
SELECT Category,max(Price)
FROM Toy_Shoppe
GROUP BY Category;
• To display category wise average price.
SELECT Category,avg(Price)
FROM Toy_Shoppe
GROUP BY Category;
• To display category wise total price.
SELECT Category,sum(Price)
FROM Toy_Shoppe
GROUP BY Category;

4-ADMISSION TABLE.
Queries:
• To display Mname, Age, Fees of those members of the ADMSN
whose fees between 1000 to 6000.
SELECT MNAME, AGE,FEES
FROM ADMSN
WHERE FEES BETWEEN 1000 AND 6000;
• To display Mcode, Mname, Age of those female members of the
ADMSN with age in descending order.
SELECT MNAME, MCODE,AGE
FROM ADMSN
WHERE SEX=”Female”
ORDER BY AGE Desc;
• To display Mname, Age, type of members of the ADMSN with Mname
in ascending order.
SELECT MNAME,AGE,TYPE
FROM ADMSN
ORDER BY MNAME;
• To display Mname, Fees of those members of the ADMISSIONwhose
Age<40 and are monthly type members of the ADMSN.
SELECT MNAME,FEES
FROM ADMSN
WHERE AGE<40 AND TYPE=’Monthly’;
• To insert a new tuple in ADMSN with the following data
(MCODE,MNAME , SEX ,AGE,FEES,TYPE)
11,’Keshav’,’M’,27,600,’Guest’
INSERT INTO ADMSN VALUES (MCODE,MNAME,SEX,AGE,FEES,TYPE)
(11,’Keshav’,’Male’,27,600,’Guest’)
• To Display Average of All female persons.
SELECT AVG(AGE) from ADMSN WHERE SEX=’Female’;

• To Display maximum fees for male persons.


SELECT MAX(FEES) FROM ADMSN WHERE SEX=’Male’;

• To Display average age of regular persons.


SELECT AVG(AGE) FROM ADMSN WHERE REMARKS=’Regular’;

5-INFANT TABLE.
Queries:
• To display the details about the ‘Cot’?
SELECT*
FROM INFANT
WHERE Item=’Cot’;

• To list the names of items and their unit price that have unit
price<800 and discount more than 5%.
SELECT Item,Unit_price
FROM INFANT
WHERE Unit_price<800 AND Discount>5;

• To list the name of items and their date of purchase that were
purchased after 31 December 2015.
SELECT Item,Date_Purchase
FROM INFANT
WHERE Date_Purchase>2015-12-31;

• To display the number of item that has more than 10% as discount.
SELECT COUNT(*)
FROM INFANT
WHERE Discount>10;

• To display the item code and unit price in the descending order of
unit price.
SELECT Item_code,Unit_price
FROM INFANT
ORDER BY Unit_price DESC;

• To increase the unit price of each item by 10% of their unit price.
UPDATE INFANT
SET Unit_Price=Unit_price+0.1*Unit_price;

• Display the highest unit price of items.


SELECT MAX(Unit_Price)
FROM INFANT;

• To display the names of items that have baby anywhere in the item
name.
SELECT Item
FROM INFANT
WHERE Item LIKE ‘Baby%’;

• SELECT MID(Item,1,2)
FROM INFANT;
• SELECT AVG(Unit_price)
FROM INFANT
WHERE Date_Purchase>2015-01-01;

6-PROJECT TABLE.

Queries:

• Display all Information about project of medium ProjSize.


SELECT *
FROM PROJECT
WHERE ProjSize="Medium";

• To List theProjSize of Projects whose ProjName Ends With LITL.


SELECT ProjSize
FROM PROJECT
WHERE ProjName LIKE "%LITL";
• To list ID Name size and cost of all Projects is descending order
of StartDate.
SELECT ID,ProjName,ProjSize,Cost
FROM PROJECT
ORDER BY StartDate DESC;
• To count the number of projects of cost less than 100000.
SELECT COUNT(*)
FROM PROJECT
WHERE Cost<100000;

• SELECT sum(Cost) FROM PROJECT;

• SELECT DISTINCT(ProjSize)
FROM PROJECT;

• SELECT COUNT(*)
FROM PROJECT
WHERE Cost>100000;
• SELECT ProjSize,COUNT(*)
FROM PROJECT
GROUP BY ProjSize;

7-EMPLOYEE TABLE.

EMP TABLE:
DEPTM TABLE:

Queries:
• Add a constraint called EMPDEPT into EMP table.
ALTER TABLE EMP
ADD CONSTRAINT EMPDEPT
FOREIGN KEY (DEPTNO) RFEFRENCES DEPTM(DEPTNO);

• To display the employee name, department name and


department number.
SELECT EMP.NAME, EMP.DEPTNO,DEPTM.DNAME
FROM EMP,DEPTM
WHERE EMP.DEPTNO=DEPTM.DEPTNO;

• To display the ename, dname and loc of all employees who earn
commission.
SELECTE.ENAME, D.DNAME, D.LOC
FROM EMP E, DEPTM D
WHERE E.COMMIS NOT NULL
AND E.DEPTNO=D.DEPTNO;

• To display the ename and dname of all the employees whose


name starts with ‘A’.
SELECT E.ENAME, D.DNAME
FROM EMP E, DEPTMD
WHERE E.ENAME LIKE ‘A%’;

• To display the name, department number and department name


for all employees who work in DELHI.
SELECT E.ENAME, D.DEPTNO,D.DNAME
FROM EMP E, DEPTM D
WHERE D.LOC=’DELHI’ AND E.DEPTNO=D.DEPTNO;
8- PRODUCT AND CLIENT.

PRODUCT TABLE:

CLIENT TABLE:

Queries:

• To display the details of the product whose price is in the range


of 40 and 120(Both values included).
SELECT*
FROM PRODUCT
WHERE PRICE BETWEEN 40 AND 120;

• To display the ClientName, City from table Client and


ProductName and Price from table Product, with their
corresponding matching P_ID.
SELECT C.CLIENTNAME,C.CITY,P.PRODUCTNAME,P.PRICE
FROM CLIENT C, PRODUCT P
WHERE C.P_ID=P.P_ID;
• To increase the price of all the products by 20.
UPDATE PRODUCT
SET PRICE=PRICE+20;

9-CLUB AND COACHES.

CLUB TABLE:

COACHES TABLE:

Queries:

• What will be the output of the following query?


SELECT SPORTSPERSON COACHNAME
FROM CLUB, COACHES
WHERE COACH_ID=COACH_NO;

• Display the name of the coach who is giving training to ‘AJAY’.


SELECT CLUB.COACHNAME
FROM CLUB,COACHES
WHERE SPORTSPERSON=”AJAY”;

• Display the name of the person and coach where coach_id =


coach_no and name of the coach is RAVINA.
SELECT COACHNAME,SPORTSPERSON
FROM CLUB,COACHES
WHERE COACHNAME=”RAVINA” AND
CLUB.COACH_ID=COACHES.COACH_NO;

• To display the coach name and sports who are teaching the same
sports.
SELECT COACHNAME,SPORTS
FROM CLUB
GROUP BY SPORTS;
10-GARMENT AND FABRICS.

GARMENT TABLE:

FABRIC TABLE:

Queries:
• To display the GCode, Description of each garment in the descending
order of GCode.
SELECT GCode, Description
FROM GARMENT
ORDER BY GCode DESC;

• To display the details of garments which have readydate in between


2007-12-08 and 2009-06-06.
SELECT*
FROM GARMENTS
WHERE ReadyDate>”2007-12-08” AND ReadyDate<=”2008-06-16”;

• To display the average price of all Garments which are made up of


fabric F03.
SELECT AVG(Price)
FROM GARMENT,FABRIC
WHERE FABRIC.FCode=”F03” AND GARMENT.FCode=FABRIC.FCode;
• To display the Fabric-wise highest and lowest price of Garments from
Garment table.
(Display FCode of each garment along with highest and lowest Price)
SELECT FCode, MAX(Price), MIN(Price)
FROM GARMENT
GROUP BY FCode;

• Give the output of the following:


• SELECT SUM(Price)
FROM GARMENTS
WHERE FCode=”F01”;

• SELECT MAX(FCode)
FROM FABRIC;

• Write the code to create Garment table.


CREATE TABLE GARMENTS
(GCode integer PRIMARY KEY,
Description varchar(15),
Price integer,
FCode varchar(3),
FOREIGN KEY(FCode) REFERENCES FABRIC(FCode),
ReadyDate date);
11-SUPPLIER AND PRODUCT.

SUPPLIER TABLE:

PRODUCT TABLE:

Queries:
• To display the Pname having same City and PCity.
SELECT S.PNAME, P.PNAME
FROM SUPPLIERS S,PRODUCTS P
WHERE S.PNAME=P.PNAME AND S.CITY=P.PCITY;

• To display the product name having city of supplier as jaipur.


SELECT PNAME
FROM SUPPLIERS
WHERE CITY=”JAIPUR”;

• To display the Pname,Sname having P# value 1.


SELECT P.PNAME , S.SNAME
FROM SUPPLIERS S,PRODUCTS P
WHERE S.PNAME=P.PNAME AND P.P=”P1”;

• To display the Pname and Pcity where qty is 340.


SELECT P.PNAME , P.PCITY
FROM SUPPLIERS S,PRODUCTS P
WHERE S.QTY=340;

• What will be the output of the following query:


SELECT P.PNAME,P.PCITY
FROM SUPPLIER,PRODUCT
WHERE CITY=PCITY;

12-BANK AND CUSTOMER.

BANK TABLE:

CUSTOMER TABLE:

Queries:

• To display the name of the customer where TBank value is same


as the BName value.
SELECT CNAME
FROM BANKS,CUSTOMERS
WHERE BANKS.BNAME=CUSTOMERS.TBANK;
• To display the Acc_no of the customer and TBank where
dateofopen is > 1997-02-01.
SELECT ACC_NO,TBANK
FROM BANKS,CUSTOMERS
WHERE BANKS.BNAME=CUSTOMERS.TBANK AND DATEOFOPEN
> “1997-02-01”;

• What will be the output of the following query:


SELECT CNAME,TBANK
FROM BANK,CUSTOMER
WHERE CNAME=TNAME;

13-DOCTORS AND PATIENTS.

DOCTOR TABLE:

PATIENT TABLE:
• Display the PatNo, PatName and corresponding DocName for
each patient.
SELECT P.PatNo,P.PatName,D.DocName
FROM PATIENTS P,DOCTORS D
WHERE P.DocID=D.DocID;

• Display the list of all patients whose OPD_Days are MWF.


SELECT*
FROM PATIENTS P,DOCTORS D
WHERE P.DocID=D.DocID AND OPD_Days=’MWF’;
Give the output:

• SELECT OPD_Days, Count(*)


FROM DOCTORS,PATIENTS
WHERE PATIENTS.Department=DOCTORS.Department
GROUP BY OPD_Days;
14-FLIGHTS AND FARES.

FLIGHT TABLE:

FARES TABLE:

Queries:

• To display the flight number, source, airlines of those flights


where fare is less than Rs.10000.
SELECT A.FNO,A.SOURCE,B.AIRLINES
FROM Flights A,Fares B
WHERE A.FNO=B.FNO AND B.Fares<10000;

• To count the total number of Indian airlines flight starting from


various cities.
SELECT SUM(Flights.NO_OF_FL)
FROM Flights , Fares
WHERE Flights.FNO=Fares.FNO GROUP BY SOURCE
AND Fares.AIRLINES="Indian Airlines";

Give The Output:


• SELECT Flights.FNO,NO_OF_FL,AIRLINES FROM Flights,Fares
WHERE Flights.FNO=Fares.FNO AND SOURCE="DELHI";

Html SECTION-C

HTML-1

<TITLE>All Style in html Code


</TITLE>
</HEAD>
<BODY BGCOLOR="Aqua" TEXT="BLACK">
BOLD :<B>Hello World!</B><BR>
ITALLIC :<I>Hello World!</I><BR>
UNDERLINE :<U>Hello World!</U><BR>
BIG :<BIG>The Big And Tail Company</BIG><BR>
SMALL :<SMALL>The Small And Short Company</SMALL><BR>
EMPHASIS :<EM>This Text is Emphasized</EM>MOST BROWER DISPLAY IT
AS ITALLICS.<BR>
BLOCKQUOTE :<BLOCKQUOTE><P>THE QUOTE IS INPUT
HERE.</P></BLOCKQUOTE>
PERFORMATTED TEXT:<PRE> TEXT GOES HERE PRESERVING
WHITESPACES
AND PRESERVING LINE BREAKS</PRE>
SUB: H<SUB>2</SUB>O<BR>
SUP: E=MC<SUP>2</SUP><BR>
TT: <TT> THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.</TT>
</BODY>
</HTML>
OUTPUT SCREENSHOT

HTML-2

</HTML>
<HEAD>
<TITLE>An HTMLform example</TITLE>
<HEAD/>
<BODY BGCOLOR="Aqua"TEXT="MAROON">
<H2>Subscribe to corpWorld</H2>
<P>Interested in receiving daily small updates of all latest exploits of
BigCort?
Well now you can. And best of all, it is free! Just fill out this form and submit
it by clicking the
"send it in" button. We will put you on our mailing list and you will receive
your first e-mail
in 3-5 days</P>
<FORM METHOD="SEND"
ACTION="http://www.fakecorp.com/ccgi.bin/subscribe">
Please complete all of the following :<BR>
First Name: <INPUT
TYPE="Text"Name="first"SIZE="25"MAXLENGTH="24"><BR>
Last Name: <INPUT
TYPE="Text"Name="first"SIZE="35"MAXLENGTH="34"><BR>
Business: <INPUT
TYPE="Text"Name="Business"SIZE="50"MAXLENGTH="49"><BR>
We must have a correct e-mail address to send you the newsletter:<BR>
Email:<INPUT TYPE="TEXT"Name="email"SIZE="50"
MAXLENGTH="49"><BR>
How did you hear about BigCrop's email letter?<BR>
<INPUT TYPE="Radio" Name="here"VALUE="web"CHECKED>Here on the
web page
<INPUT TYPE="Radio" Name="here"VALUE="mag">In a magazine
<INPUT TYPE="Radio" Name="here"VALUE="paper">Newspaper story
<INPUT TYPE="Radio" Name="here"VALUE="other">Other
<BR>Would you care to be on our regular mailing list?<BR>
<INPUT TYPE="CHECKBOX" NAME ="SNAILMAIL"CHECKED>
YES, we love junk main <BR>
<INPUT TYPE="RESET">
<INPUT TYPE="SUBMIT"VALUE="SEND it in!">
</FORM>
</BODY>
</HTML>
OUTPUT SCREENSHOT

HTML-3

<HTML>
<HEAD>
<TILTE>A table example</TITLE>
</HEAD>
<BODY>
<table border="1" cellpadding="10"width="70%"BORDERCOLOUR=LIME
bgcolour=YELLOW>
<tr align="center"><th rowspan="2">Year</th><th
colspan="3">Sales(Rs.)</th></tr>
<tr align="center"><th>North</th><th>South</th><th>Total</th></tr>
<tr
align="center"><td>2012</td><td>80M</td><td>60M</th><td>140M</td>
</tr>
<tr
align="center"><td>2013</td><td>92M</td><td>68M</td><td>160M</td>
</tr>
</table>
</BODY>

</HTML>

OUTPUT SCREENSHOT

S-ar putea să vă placă și