Documente Academic
Documente Profesional
Documente Cultură
OF
INFORMATICS PRACTICES
SESSION : 2019-20
BY
Tarun Kumar Roy
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
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
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.
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.
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
Questions:
• Using a JButton’s (Compute Discount) click event handler,
display the amount in a JTextField(txtDisc) control.
SCREENSHOT
CODING
else if(StationaryRB.isSelected())
{
discount=discount+0.01;//extra 1%
}
txtDisc.setText(""+Math.round(cost*discount));
}
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.
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.
CODING
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
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.
SCREENSHOT
CODING
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:
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);
}
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
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
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.
SCREENSHOT
CODING
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
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.
CODING
10-DUCOM ENTERPRISES.
DOCUMENTATION
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”.
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
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
12-CLUB MAHINDRA.
DOCUMENTATION
• 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
SCREENSHOT
CODING
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
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.
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:
CODING
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
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);
}
OUTPUT SCREENSHOT
16- MAXWELL PUBLIC SCHOOL
DOCUMENTATION
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.
CODING
18-CLASS CONCEPT
DOCUMENTATION
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);}
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
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
SCREENSHOT
CODING
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.
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).
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
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
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
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
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
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
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
CODING
28-INSERTING DATABASE
RECORDS
DOCUMENTATION
TNAME Varchar 25
TADDRESS Float 25
SALARY Float
DEPT_NO Char 4
DOJ Date
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 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’);
• 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’;
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’;
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;
• 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:
• 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 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;
PRODUCT TABLE:
CLIENT TABLE:
Queries:
CLUB TABLE:
COACHES TABLE:
Queries:
• 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;
• SELECT MAX(FCode)
FROM FABRIC;
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;
BANK TABLE:
CUSTOMER TABLE:
Queries:
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;
FLIGHT TABLE:
FARES TABLE:
Queries:
Html SECTION-C
HTML-1
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