Professional Documents
Culture Documents
PDFFF
PDFFF
PDFFF
EXPERIMENT-1
BRIEF DESCRIPTION:
The HTML DOM Window navigator property is used to return a Navigator object. The navigator
object contains information about the browser. This Navigator object containsmethods and
properties of the application which is run the script.
SOURCE CODE:
JSS Academy of Technical Education Department of IT
Ridhi Gupta 210091013010086
JSS Academy of Technical Education Department of IT
OUTPUT:
JSS Academy of Technical Education Department of IT
EXPERIMENT-2
OBJECTIVE: Design HTML form for keeping student record and validate it using javascript.
SOURCE CODE:
[ r ] [ r ] [ r ]
JSS Academy of Technical Education Department of IT
OUTPUT:
EXPERIMENT-3
OBJECTIVE: Write a java program to display browser information.
SOURCE CODE:
OUTPUT:
EXPERIMENT-4
OBJECTIVE: To write a JavaScript program to define a user defined function for various operations.
SOURCE CODE:
OUT
Experiment-5
Objective: Write a program in java to implement method overloading.
BRIEF DESCRIPTION:
Method overloading in Java means having two or more methods (or functions) in a classwith
the same name and different arguments (or parameters). It can be with a different number of
arguments or different data types of arguments.
Source code:
return x + y;
return x + y;
OUTPUT:
int: 13
double: 10.559999999999999
Experiment-6
OBJECTIVE: Write a program in java to implement operator overloading.
BRIEF DESCRIPTION: Operator overloading is syntactic sugar, and is used because itallows
programming
using notation nearer to the target domain and allows user-defined types a similar levelof
syntactic support as types built into a language.
SOURCE CODE:
class MyNumber {
this.value = value;
return value;
class OperatorOverloadingDemo {
num1.subtract(num2);
OUTPUT:
Sum: 8
Difference: 2
Experiment-7
Source code:
class parent
{
int i; int j;
parent(int a, int b)
{
i=a;
j=b;
}
void show(){{ System.out.println("i&m"+i+" "+j);
}
}
}
class child extends parent{ int k;
child(int a, int b , int c){ super(a,b);
k=c;
}
void show(){
System.out.println("k"+" "+k);
}
}
class methodoverride{
public static void main(String args[]){ child subob= new child(1,2,3); subob.show();
}
}
OUTPUT:
k3
Experiment-8
OBJECTIVE: Writing program in XML for creation of DTD, which specifies set of rules. Create a
style sheet in CSS/ XSL & display the document in internet explorer.
BRIEF DESCRIPTION:
A DTD defines the structure and the legal elements and attributes of an XML document.
SOURCE CODE:
<!DOCTYPE note[
<!ELEMENT to (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<mani>JSS</mani>
<heading>Reminder</heading>
</note>
This XML file does not appear to have any style information associated with it. The document
tree is shown below.
<note>
<to>Tove</to>
<from>Jani</from>
<mani>JSS</mani>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Experiment-9
Objective:. Write a Java applet to display the Application Program screen i.e. calculator and
other.
Souce code:
import java.awt.Button;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
class Calculator implements ActionListener{
Frame f=new Frame();
Label l1=new Label("First Number"); Label
l2=new Label("Second Number");Label
l3=new Label("Result");
TextField t1=new TextField();
TextField t2=new TextField();
TextField t3=new TextField();
Button b1=new Button("Add");
Button b2=new Button("Sub");
Button b3=new Button("Mul");
Button b4=new Button("Div");
Button b5=new Button("Cancel");
Calculator(){
l1.setBounds(100,100,100,20);
l2.setBounds(100,140,100,20);
l3.setBounds(100,180,100,20);
t1.setBounds(200,100,100,20);
t2.setBounds(200,140,100,20);
t3.setBounds(200,180,100,20);
b1.setBounds(50,250,50,20);
b2.setBounds(110,250,50,20);
b3.setBounds(170,250,50,20);
b4.setBounds(230,250,50,20);
b5.setBounds(290,250,50,20);
f.add(l1);
f.add(l2);
f.add(l3);
f.add(t1);
f.add(t2);
f.add(t3);
f.add(b1);
f.add(b2);
f.add(b3);
f.add(b4);
f.add(b5);
b1.addActionLi
stener(this);
b2.addActionLi
stener(this);
b3.addActionLi
stener(this);
b4.addActionLi
stener(this);
b5.addActionLi
stener(this);
f.setLayout(nul
l);
f.setVisible(tru
e);
f.setSize(600,5
50);
}
public void
actionPerformed(ActionEvent
e){int
n1=Integer.parseInt(t1.getText
());
int
n2=Integer.parseInt(t2.ge
tText());
if(e.getSource()==b1){
t3.setText(String.valueOf(n1+n2));
}
if(e.getSource()==b2){
t3.setText(String.valu
KCS551
R Ridhi Gupta 2100910130086
JSS Academy of Technical Education Department of IT
Of(n1-n2));
}
if(e.getSource()==b3){
t3.setText(String.value
Of(n1*n2));
}
if(e.getSource()==b4){
t3.setText(String.value
Of(n1/n2));
}
if(e.getSo
urce()=
=b5){
System
.exit(0)
}
}
public static void main(String...s){
new Calculator();
}
OUTPUT:
KCS551
R Ridhi Gupta 2100910130086