PDFFF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

JSS Academy of Technical Education Department of IT

EXPERIMENT-1

OBJECTIVE:-Write HTML/Java scripts to display your CV in navigator, your institute website.


Department Website and tutorial website for specific subject.

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

KCS551 Ridhi Gupta 2100910086


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:

KCS551 Ridhi Gupta 2100910086


JSS Academy of Technical Education Department of IT

KCS551 Vrishhti Goel 21009101


JSS Academy of Technical Education Department of IT

[ r ] [ r ] [ r ]
JSS Academy of Technical Education Department of IT

OUTPUT:

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

EXPERIMENT-3
OBJECTIVE: Write a java program to display browser information.

SOURCE CODE:

OUTPUT:

KCS551 Ridhi 2100910130086


JSS Academy of Technical Education Department of IT

EXPERIMENT-4
OBJECTIVE: To write a JavaScript program to define a user defined function for various operations.

SOURCE CODE:

KCS551 Ridhi 2100910130086


JSS Academy of Technical Education Department of IT

OUT

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

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:

public class methodoverLoad {

static int plusMethod(int x, int y) {

return x + y;

static double plusMethod(double x, double y) {

return x + y;

public static void main(String[] args) {

int myNum1 = plusMethod(8, 5);

double myNum2 = plusMethod(4.3, 6.26);

System.out.println("int: " + myNum1);

System.out.println("double: " + myNum2);

OUTPUT:

int: 13

double: 10.559999999999999

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

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 {

private int value;

public MyNumber(int value) {

this.value = value;

public MyNumber add(MyNumber other) {

int result = this.value + other.value;

return new MyNumber(result);

public MyNumber subtract(MyNumber other) {

int result = this.value - other.value;

return new MyNumber(result);

public int getValue() {

return value;

class OperatorOverloadingDemo {

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

public static void main(String[] args) { MyNumber

num1 = new MyNumber(5); MyNumber num2

= new MyNumber(3); MyNumber sum =

num1.add(num2); MyNumber difference =

num1.subtract(num2);

System.out.println("Sum: " + sum.getValue());

System.out.println("Difference: " + difference.getValue());

OUTPUT:

Sum: 8

Difference: 2

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

Experiment-7

Objective: Write a program in java to implement method overloading.

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

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

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:

DTD stands for Document Type Definition.

A DTD defines the structure and the legal elements and attributes of an XML document.

SOURCE CODE:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE note[

<!ELEMENT note (to,from,mani,heading,body)>

<!ELEMENT to (#PCDATA)>

<!ELEMENT from (#PCDATA)>

<!ELEMENT mani (#PCDATA)>

<!ELEMENT heading (#PCDATA)>

<!ELEMENT body (#PCDATA)>

]>

<note>

<to>Tove</to>

<from>Jani</from>

<mani>JSS</mani>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

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>

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

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

KCS551 Ridhi Gupta 2100910130086


JSS Academy of Technical Education Department of IT

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

You might also like