Vous êtes sur la page 1sur 21

LAB ASSIGNMENT REPORT

On

BCA651
Web Technologies & Java
Programming Lab

COLLEGE OF COMPUTING SCIENCES AND


INFORMATION TECHNOLOGY
TMU, MORADABAD

Session: JAN 2015 - JUNE 2015

Submitted To:

Submitted

By:
Ms. Shikha Garg
Mr. Deependra Rastogi

Student Name :
Enrollment No. :

Course :
Section: B
LAB ASSIGMENT NAME Web Technology (HTML)
LAB ASSIGMENT NO. - 1

S
No
1
2
3

4
5

6
7

Program Name
Write HTML code for inserting image in
background of the web page and a moving
text My Page.
Write HTML code for creating an ordered
list of product. List should contain at least
10 items.
Create a html page that contains any
multiline text for describing TMU using
paragraph [<p> tag] and line break [</br>
tag].
Create a html page and apply horizontal
rule.
Write HTML code for creating an unordered
list of product. List should contain at least
10 items. Also add heading to the page
My List
Write the following text in HTML(i) 2H2O
(ii) CopyRight(c)
Create a html page that contains the text
as Teerthanker Mahaveer University and
make it (I) bold (II) italic (III) underlined
(IV) emphasized (V) striked (VI) centered
Create a html page that display computer
code like
for i = 1 to 10
print i
next i
Create a html page having ordered list as
1)
MCA
MASTER
OF
COMPUTER
APPLICATIONS
2)
MBA-MASTER
OF
BUSINESS

Page
No

Date

Sign

Remar
k

ADMINISTRTION
3)
BBA-BECHLOR
OF
BUSINESS
ADMINISTRTION
4)
BCABECHLOR
OF
COMPUTER
APPLICATIONS
10
Create a html page having some text like
WEB TECHONOLOGIES.
i) i) Take background color of the document
as yellow.
ii) ii) Take some image in the background of
the document.

LAB ASSIGMENT NAME Web Technology (HTML)


LAB ASSIGMENT NO. - 2

S
No
1
2
3

4
5
6

Program Name

Page
No

Write HTML code for creating marksheet.


Draw an HTML page for your Resume.
Create the html page with colspan attribute
in the following manner
Name

Telephone

Bill
Gates

555
854

77 555
855

77

Create an HTML page to display a table of


size 3 x 4. Also insert text and images into
it.
Create a html page and use attribute like
border, cellspacing and cellpadding in the
table.
Create a html page that has marquee as
TEERTHANKER
MAHAVEER
UNIVERSITY.
When we hold mouse over this marquee
then the moving text is stopped and show
marquee movement as horizontal as well

Date

Sign

Remar
k

as vertical direction.
7
Create a html page and apply style on all
header from h1 to h6 and make color of all
header green and font size of all header
same. Group all headers elements.
8
Create a html page that uses external style
sheet namely style.css and mention style
like background color of the body as
white, color of h1 header as green and
font-size of h1 header as 20pt, color
horizontal rule as navy, font-size for
paragraph as 14pt, left margin of
paragraph text as 50pt and finally hover
style color for hyperlink as yellow
9
Create a html page and apply different
types of color for the hyperlink when it is
visited then set color as red ,when it is
hover then set color as yellow and when it
is active then set color as blue.
10
Display the Text Box, Radio Button and Text
Area in an HTML page. Also check whether
they are null or not.
LAB ASSIGMENT NAME Web Technology (HTML)
LAB ASSIGMENT NO. - 3

S No

Program Name

Calculate the factorial of a given number


using JavaScript.
Calculate the Fibonacci series upto 9
numbers using JavaScript.
Create an HTML page to display the
sorted array using Bubble Sort.
Write a html program using JavaScript
and show Hello World in a web page.
Calculate the Fibonacci series where user
will enter the range in JavaScript.
Create a Frame and link it with an html
page
Create an array of size n and insert n
elements into it using JavaScript.

2
3
4
5
6
7

Page
No

Date

Sign

Remar
k

WAP print the maximum element present


in an array of size n using function in
JavaScript.
Write a html program using JavaScript to
validate the textfield of login form for
empty values.
Write a html program using JavaScript to
implement various events like onload,
onblur, onchange, onfocus.

9
10

LAB ASSIGMENT NAME Java Programming


LAB ASSIGMENT NO. - 1
S No

Program Name

A positive natural number, (for e.g. 27),


can be represented as follows:
2+3+4+5+6+7
8+9+10
13+14
where every row represents a
combination of consecutive natural
numbers, which add up to 27.
Write a program which inputs a positive
natural number N and prints the possible
consecutive number combinations, which
when added give N.

Page
No

Date

Sign

Remar
k

3
4

Write a Program in Java to input a


number and check whether it is
a Disarium Number or not.
Note: A number will be called DISARIUM
if sum of its digits powered with their
respective position is equal to the
original number.
For example 135 is a DISARIUM
(Workings 11+32+53 = 135, some
other DISARIUM are 89, 175, 518 etc)
Write a program to perform the Kapreker
Number.
Write a Program in Java to input a
number and check whether it is
an Automorphic Number or not.
Note: An automorphic number is a
number which is present in the last
digit(s) of its square.
Example: 25 is an automorphic number
as its square is 625 and 25 is present as
the last digits.
A smith number is a composite number,
the sum of whose digits is the sum of the
digits of its prime factors obtained as a
result of prime factorization (excluding
1). The first few such numbers are 4, 22,
27, 58, 85, 94, 121.....
Example 1.
666 Prime factors are 2, 3, 3 and 37
Sum of the digits are (6+6+6) = 18
Sum of the digits of the factors
2+3+3+(3+7) = 18
Sample data:
Input 94 Output SMITH Number
Input 102 Output NOT SMITH Number
Write a program for the following pattern
1
1
2
1
1
2
3
2
1
1
2
3
4
3
2
1

9
10

11

WAP that concatenates two byte values into


one i.e. if a = 10011001 and b = 11001100,
then result should be the decimal equivalent
of 1001100111001100.
Perform multiplication of N numbers
provided from command line argument.
A bank intends to design a program to
display the denomination of an input
amount, upto 5 digits. The available
denominations with the bank are of rupees
1000,500, 100, 50, 20, 10, 5, 2 and 1.
Design a program to accept the amount
from the user and display the break-up in
descending order of denominations. (i,e
preference should be given to the highest
denomination available) along with the total
number
of
notes.
[Note:
only
the
denomination used should be displayed].
Example 1:
INPUT: 14836
OUTPUT: ONE FOUR EIGHT THREE SIX
DENOMINATION:
1000 X 14 =14000
500 X 1 =500
100 X 3 =300
50 X 1 =50
5 X 1 =5
1 X 1 =1
EXAMPLE 2:
INPUT: 235001
OUTPUT: INVALID AMOUNT

Write a program which contain 10 element


and sort it using bubble sort, selection sort
and insertion sort technique.
Write a program which contains two arrays A
and B. A Contain 25 elements whereas B
contain 30 elements and Array C that
contain only those elements that are
common to A and B.
Write a program to declare a square matrix
A[ ][ ] of order n. Allow the user to input
positive integers into this matrix. Perform

the following tasks on the matrix:


(i) Output the original matrix.
(ii) Find the SADDLE POINT for the
matrix. If the matrix has no saddle
point, output the message NO
SADDLE POINT.
[Note: A saddle point is an element of the
matrix such that it is the minimum element
for the row to which it belongs and the
maximum element for the column to which it
belongs. Saddle point for a given matrix is
always unique.]
Example: In the Matrix
456
789
513
Saddle point = 7 because it is the minimum
element of row 2 and maximum element of
column 1

12

Write a Program in Java to fill a square


matrix of size n*n in a spiral fashion
(from the inside) with natural numbers
from 1 to n*n, taking n as input.
For example: if n = 5, then n*n = 25,
hence the array will be filled as given
below.

13

A square matrix is said to be a Magic Square,


if the sum of each row, each column and
each diagonal is same. Write a program to
enter an integer number n. Create a magic
square of size n*n. Finally, print the
elements of the matrix as Magic Square.

Note: n <= 5
Sample Input: Enter the size of the
matrix : 4
Sample Output: The Magic Matrix of

size 44 is:

14

15

16

17

To write a java program to display total


marks of 5 students using student class.
Given the fallowing attribute: Regno(int),
Name(string), Marks in subjects(int array),
Total(int).
Define a class named MyDay that
implements the day of the week in a
program. The class MyDay should store the
day, such as Sun for Sunday. The program
should be able to perform the following
operations on an object of the type MyDay:
a) Set the day.
b) Print the day.
c) Return the day.
d) Return the next day.
e) Return the previous day.
The class should also has the appropriate
constructor. Write a program to test all the
operations for class MyDay as described in a.
to e. above.
Write a java Program in which to perform
complex number arithmetic operation such
as Addition, Subtraction, Multiplication, and
Division. Number should be taken by the
user.
Define a Student class (roll number, name,
percentage).
Define
a
default
and
parameterized constructor. Override the
toString method. Keep a count objects
created. Create objects using parameterized
constructor and display the object count
after each object is created. (Use static
member and method). Also display the

18

19

contents of each object.


Define an inheritance hierarchy to represent
Quadrilateral, Trapezoid, Rectangle and
Sqaure. The (x,y) coordinates of the four end
point of the shapes should be taken as
points in the super class. Write methods to
display the coordinates and area of the
shapes. Create a java program that create a
set of shapes and display their area.
Write a program to code the inheritance
hierarchy of Figure. We will define the
attributes and the methods as shown in
table:
Class
Person
Student
Gradua
te
Post
Gradua
te
Teacher

20

21

Attribute
s
Name
Roll no,
Course
Branch
Branch,
Grade

Methods
Constructor
Constructor,
display
Constructor,
display
Constructor,
display

Qualificati
Constructor,
on,
display,
Designatio setQualificati
n
on, promote
Create an abstract class Shape with
methods
Person
calc_area and calc_volume. Derive three
classes Sphere(radius) , Cone(radius, height)
and Cylinder(radius, height), Box(length,
breadth, height)
area and
Studentfrom it. Calculate
Teacher
volume of all. (Use Method overriding).
Graduate
Post Graduate
Define
an abstract
class Staff with
members name and address. Define two
subclasses of this class FullTimeStaff
(department, salary) and PartTimeStaff
(number_of_hours, rate_per_hour). Define
appropriate constructors. Create n objects
which could be of either FullTimeStaff or
PartTimeStaff class by asking the users
choice. Display details of all FullTimeStaff

objects and all PartTimeStaff objects.


Demonstrate the concept for the following
operation.
I.
Stopping Overriding with Final
II.
Stopping Inheritance with Final
III.
Creating Constant with Final
IV.
Perform the operation of Object Class

22

LAB ASSIGMENT NAME Java Programming


LAB ASSIGMENT NO. - 2

S No

Program Name

Page

Date

Sign

Remar

No
1

Create a package named Maths. Define


class
MathsOperations
with
static
methods to find the maximum and
minimum of three numbers. Create
another package Stats. Define class
StatsOperations with methods to find the
average and median of three numbers.
Use these methods in main to perform
operations on three integers accepted
using command line arguments.
Write a Java program to create a Package
SY which has a class SYMarks
(members ComputerTotal, MathsTotal,
and ElectronicsTotal). Create another
package TY which has a class TYMarks
(members Theory, Practicals). Create n
objects
of
Student
class
(having
rollNumber,
name,
SYMarks
and
TYMarks). Add the marks of SY and TY
computer subjects and calculate the
Grade (A for >= 70, B for >= 60 C
for >= 50 , Pass Class for > =40 else
FAIL) and display the result of the
student in proper format.
Create an interface, "PrimeTester", that
defines one method "boolean isPrime(int
n)". When this function is called the
implementing class should determine if
the given "n" is prime or not.
Define an interface IntOperations with
methods to check whether an integer is
positive, negative, even, odd, prime and
operations like factorial and sum of
digits. Definea class MyNumber having
one private int data member. Write a
default constructor to initialize it to 0 and
another constructor to initialize it to a
value (Use this). Implement the above
interface. Create an object in main. Use

command line arguments to pass a value


to the object and perform the above
operations using a menu.
Create a class Student with attributes
roll no, name, age and course. Initialize
values
through
parameterized
constructor. If age of student is not in
between 15 and 21 then generate userdefined
exception
AgeNotWithinRangeException. If name
contains numbers or special symbols
raise
exception
NameNotValidException. Define the
two exception classes.
Define class MyDate with members day,
month,
year.
Define
default
and
parameterized
constructors.
Accept
7values from the command line and
create a date object. Throw user defined
exceptions InvalidDayException or
InvalidMonthException if the day and
month are invalid. If the date is valid,
display message Valid date.
Write a multithreaded java program to
print all number below 10000 that are
both prime and Fibonacci number.
Design a thread that generates prime
number below 10000 and writes them
into a pipe. Design another thread that
generates Fibonacci number and writes
them to another pipe. The main thread
should read both the pipes to identify
number common to both.
To write a java program for generating
two threads, one for generating even
number and one for generating odd
number.
To write a java program to develop a
producer and consumer problem using
thread

10

11

12

13
14

15

16

Write a java program to create five


threads with different priorities. Send two
threads of the highest priority to sleep
state. Check the aliveness of the threads
and mark which thread is long lasting.
ByteArrayInputStream create two byte
array strams- one to represent our
sample string completely and other to
represent only the first two words.
Write a program to extract the tokens in
a string passed in command line and
display the token along with its type.
(using StreamTokenizer)
Write a program that will copying
content of a file to another.
Write a program to count the number of
occurrence of the character & in a file
given in the command line.
Write a program to determine whether
the two files given in command line are
identical.(Using RandomAccessFile)
Write a program to input a word from the user
and remove the duplicate characters present
in it.
Example:
INPUT abcabcabc
OUTPUT abc
INPUT javaforschool
OUTPUT javforschl
INPUT Mississippi
OUTPUT Misp

17

Write a program to accept a sentence


from the user and perform the following
task:
(a)
Accept the sentence and reduce
all the extra blank space between two
words to
a single blank space.
(b)
Accept a word from the user

which is part of the sentence along with


its position number and delete the word
and display the sentence.
Test your program with the sample data
and some random data:
Example 1
INPUT: A MORNING WALK IS A IS
BLESSING FOR THE WHOLE DAY.
WORD TO BE DELETED: IS
WORD POSITION IN THE SENTENCE: 6
OUTPUT: A MORNING WALK IS A
BLESSING FOR THE WHOLE DAY.
Example 2
INPUT: AS YOU
REAP.

SOW, SO SO YOU

WORD TO BE DELETED: SO
WORD POSITION IN THE SENTENCE: 4
OUTPUT:

18

AS YOU SOW, SO YOU REAP

Write a program to print the words of the input


in reverse order without any punctuation
marks other than blanks.
NOTE : Individual words (i.e. characters of
every word) are not reversed
For example, Consider the following input text:
INPUT:
Enter number of sentences: 2
Enter the sentences:
This is a sample piece of text to illustrate this
question
if you are smart you will solve this right.
OUTPUT: right this solve will you smart are
you if question this illustrate to text of piece
sample a is this
Enter number of sentences: 1
Enter the text: Do not judge a book by its

cover.
Sample Output: Cover its by book a judge
not do

19

20

Write a program to input a string (word).


Convert it into lowercase letters. Count and
print the frequency of each alphabet present in
the string. The output should be given as:
Sample Input: Alphabets
Sample Output:
==========================
Alphabet
Frequency
==========================
a
2
b
1
e
1
h
1
l
1
p
1
s
1
t
1
WAP for swaps the values of two Strings
without using any third (temp) variable.

LAB ASSIGMENT NAME Java Programming


LAB ASSIGMENT NO. - 3

S No

Program Name

Page
No

Write an Applet to display the message


Applet runs in sand box in the applet

viewer or browser.
WAP to print different shapes on an
Applet window like square, rectangle,

circle, ellipse, pentagon.


WAP to enter two numbers in two
different text boxes. Add a button on the
Applet. The program should print the
sum of the two numbers of the Applet

window.
WAP to add 3 buttons on an Applet
labeled

Red,

Green

and

Blue.

The

program should change the background


color of the Applet window when the
5

respective buttons are pressed.


Write an application that accepts strings

Date

Sign

Remar
k

from the user in a text box. As soon as


the user press Enter key the string
should be added in a list box. Add a
button to the applet, which when clicked
selects only those strings that ends with
ED and adds the selected strings to
6

another list box.


WAP to add two textboxes (T1 and T2),
two list boxes (L1 and L2) and two
buttons (B1 and B2) in an Applet. When
the user types any text in T1 or T2 and
press enter, the text should be added in
the list boxes L1 and L2 respectively.
When the user selects an item from the
list L1 and press the button B1, the
selected item should be moved to list L2

and vice-versa.
Write an applet with a button at its lower
portion, when the button is clicked, the
program creates one more internal frame
and displays it at the center of the

applet.
Write an applet that contains textfields
and

radio

buttons.

The

user

enters

his/her name in the textfield and when


one of the radio button Male or Female is
clicked the name is prefixed with Hello
Mr or Hello Ms and displayed in
9

another text field.


WAP to display 3 scrollbars representing
colors Red, Green and Blue respectively
in an Applet. When the user scrolls any

of the scrollbar, the background color of


the Applet should change depending
upon the combination of the values of
the scrollbars. For eg, the applet should
display the background color as black
when the value of all the three scrollbars
10

are 0.
Write an Applet program to display a

11

moving Ball.
WAP to create a Frame window along
with a button. The program should open
a new Frame window when the button is

12

clicked.
WAP to display a progress bar and a
button using Swing. The progress bar
should be filled with a delay of 0.5

13

seconds when the button is clicked.


WAP to display 3 buttons and a list box
using Swing. The window should change
the Look and Feel when the buttons are
clicked. The list box should display all the

14
15

supported look and feels available.


WAP to display JTabbedPane and toolbar.
Write a java code consisting of tabbed
pane. A tabbed pane has three panesfirst pane consist of buttons, second
pane consists of check box and third

16

pane consist of radio buttons.


WAP to display 2500 buttons on a JFrame
using GridLayout (50 by 50). Use the
concept ScrollPane so that they can be

17

displayed easily.
Write a Menu Driven program in JFrame.

Display inner frame when the menu item


18

is clicked.
WAP to display the use of Split pane,

19

Image.
WAP to

20

JInternalFrame, Border and JOptionPane.


Create a swing application to display a

demonstrate

the

use

of

menu bar where each menu item should


21

display a dialog box to show its working.


WAP to enter the details of an employee
in a window. The window should display
a button which when clicked, adds the
employee record in the database (MSACESS).

22

Create a swing application that could


retrieve

all

the

records

from

the

Employee table and display them on the


window with the help of a table (MSACESS).
23

Create

an

application

which

stores,

update, delete, view all or individual


record and searches record of student
24

display appropriate message. (MY-SQL)


Create a swing application to implement
Login form for any application. It should
check the validity with the help of Login

25
26

table. (MY-SQL)
WAP to display a message on a JSP page.
Design a login page in jsp and check
whether the user is authorized or not.
Also welcome the user by its name and
displaying

the

current

time

and

an

image.