[go: up one dir, main page]

0% found this document useful (0 votes)
26 views24 pages

Java Labbook

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views24 pages

Java Labbook

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Savitribai Phule Pune University

T. Y. B. B. A. (C. A.) Semester-V


(CBCS 2019 Pattern)

Core Java, MongoDB / Python


CA-506: Lab Book

Student Name: __________________________________________________

College Name: __________________________________________________

Roll No.: _____________ Division: ____________ Seat No: ____________

Academic Year: ________________________________

1
CERTIFICATE
This is to certify that Mr./Ms._________________________________
student of BBACA Semester_________ having Seat No.
_______________at Suryadatta College of Management
Information Research & Technology (SCMIRT), Pune, has
successfully completed the assigned practical in
_____________________________ prescribed by the Savitribai Phule
Pune University during the academic year__________________.

Internal Examiner External


Examiner

Principal
Place: Pune
Date:

2
ASSIGNMENT INDEX

S.No Assignment No. Set Question Date Teacher's


Signature
1 Assignment No. Practice Write a Java Program to
1: Introduction to Set check whether given
Java String is Palindrome or
not.
2 Assignment No. Practice Write a Java program
1: Introduction to Set which accepts three
Java integer values and prints
the maximum and
minimum.
3 Assignment No. Practice Write a Java program to
1: Introduction to Set accept a number from
Java command prompt and
generate multiplication
table of a number.
4 Assignment No. Practice Write a Java program to
1: Introduction to Set display Fibonacci series.
Java
5 Assignment No. Practice Write a Java program to
1: Introduction to Set calculate sum of digits of
Java a number.
6 Assignment No. Practice Write a Java program to
1: Introduction to Set accept a year and check if
Java it is leap year or not.
7 Assignment No. Practice Write a Java program to
1: Introduction to Set display characters from A
Java to Z using loop.
8 Assignment No. Practice Write a Java program to
1: Introduction to Set accept two numbers using
Java command line argument
and calculate addition,
subtraction,

3
multiplication and
division.
9 Assignment No. Practice Write a Java Program to
1: Introduction to Set calculate the sum of first
Java and last digit of a number.
10 Assignment No. Practice Write a Java program to
1: Introduction to Set calculate the sum of even
Java numbers from an array.
11 Assignment No. Set A Write a Java Program to
1: Introduction to check whether given
Java number is Prime or Not.
12 Assignment No. Set A Write a Java Program to
1: Introduction to display all the perfect
Java numbers between 1 to n.
13 Assignment No. Set A Write a Java Program to
1: Introduction to accept employee name
Java from a user and display it
in reverse order.
14 Assignment No. Set A Write a Java program to
1: Introduction to display all the even
Java numbers from an array.
(Use Command Line
arguments)
15 Assignment No. Set A Write a Java program to
1: Introduction to display the vowels from a
Java given string.
16 Assignment No. Set B Write a Java program to
1: Introduction to accept n city names and
Java display them in ascending
order.
17 Assignment No. Set B Write a Java program to
1: Introduction to accept n numbers from a
Java user, store only
Armstrong numbers in an
array and display it.
18 Assignment No. Set B Write a Java program to
1: Introduction to search given name into
Java the array, if found then
display its index otherwise
appropriate message.
19 Assignment No. Set B Write a Java program to
1: Introduction to display pattern: 5 | 4 5 | 3

4
Java 45|2345|12345
20 Assignment No. Set B Write a Java program to
1: Introduction to display pattern: 1 | 0 1 | 0
Java 10|1010
21 Assignment No. Set C Write a Java program to
1: Introduction to count the frequency of
Java each character in a given
string.
22 Assignment No. Set C Write a Java program to
1: Introduction to display each word in
Java reverse order from a
string array.
23 Assignment No. Set C Write a Java program for
1: Introduction to union of two integer
Java arrays.
24 Assignment No. Set C Write a Java program to
1: Introduction to display transpose of a
Java given matrix.
25 Assignment No. Set C Write a Java program to
1: Introduction to display alternate
Java characters from a given
string.
26 Assignment No. Practice Write a Java program to
2: Classes, Set implement reference
Objects and variable.
Methods
27 Assignment No. Practice Write a Java program to
2: Classes, Set count objects created in a
Objects and class. Display count after
Methods each object.
28 Assignment No. Practice Write a Java program to
2: Classes, Set convert integer primitive
Objects and data using toString().
Methods
29 Assignment No. Practice Write a Java program to
2: Classes, Set calculate sum of digits
Objects and using recursion.
Methods
30 Assignment No. Practice Write a Java program to
2: Classes, Set demonstrate use of ‘this’
Objects and keyword.
Methods

5
31 Assignment No. Set A Write a Java program to
2: Classes, calculate power of a
Objects and number using recursion.
Methods
32 Assignment No. Set A Write a Java program to
2: Classes, display Fibonacci series
Objects and using function.
Methods
33 Assignment No. Set A Write a Java program to
2: Classes, calculate area of Circle,
Objects and Triangle, Rectangle (use
Methods method overloading).
34 Assignment No. Set A Write a Java program to
2: Classes, copy data of one object to
Objects and another.
Methods
35 Assignment No. Set A Write a Java program to
2: Classes, calculate factorial using
Objects and recursion.
Methods
36 Assignment No. Set B Define class Person(pid,
2: Classes, pname, age, gender). Use
Objects and default and
Methods parameterized
constructor. Accept &
display 5 records.
37 Assignment No. Set B Define class Product(pid,
2: Classes, pname, price). Accept
Objects and details and calculate total
Methods using array of objects.
38 Assignment No. Set B Define class
2: Classes, Student(rollno, name,
Objects and per). Create n objects,
Methods display using toString().
39 Assignment No. Set B Define class MyNumber
2: Classes, with methods isPositive
Objects and and isNegative. Use
Methods command line args.
40 Assignment No. Set C Define class Student(rno,
2: Classes, name, mark1, mark2) and
Objects and inner class Result. Display
Methods marksheet.

6
41 Assignment No. Set C Write a Java program to
2: Classes, accept n employee names,
Objects and sort and display them
Methods using static keyword.
42 Assignment No. Set C Write a Java program to
2: Classes, accept details of n cricket
Objects and players and display player
Methods with max average.
43 Assignment No. Set C Write a Java program to
2: Classes, accept n books and
Objects and display quantity of a given
Methods book.
44 Assignment No. Practice Create abstract class
3: Inheritance, Set Shape with method area().
Package and Inherit Rectangle and
Collection Triangle and calculate
area.
45 Assignment No. Practice Create Teacher class.
3: Inheritance, Set Accept n teachers and
Package and display those who teach
Collection Java. (Use array of
objects)
46 Assignment No. Practice Create Doctor class.
3: Inheritance, Set Accept n doctors and
Package and display in ascending order
Collection of name.
47 Assignment No. Practice Accept ‘n’ employee
3: Inheritance, Set names through command
Package and line, store in Vector,
Collection display names starting
with ‘S’.
48 Assignment No. Practice Create package
3: Inheritance, Set Mathematics with classes
Package and Maximum and Power.
Collection Accept 2 numbers, find
max and calculate power.
49 Assignment No. Set A Calculate area of Cylinder
3: Inheritance, and Circle using super
Package and keyword.
Collection
50 Assignment No. Set A Define Interface Shape
3: Inheritance, with method area().

7
Package and Calculate area of Circle
Collection and Sphere. Use final
keyword.
51 Assignment No. Set A Define Interface “Integer”
3: Inheritance, with method check().
Package and Check if number is
Collection Positive or Negative.
52 Assignment No. Set A Define class Student with
3: Inheritance, rollno and name.
Package and Override toString().
Collection Count objects created.
53 Assignment No. Set A Accept n integers from
3: Inheritance, user & store in ArrayList.
Package and Display elements in
Collection reverse order.
54 Assignment No. Set B Create abstract class
3: Inheritance, Shape with methods
Package and calc_area() and
Collection calc_volume(). Derive
Sphere and Cone.
55 Assignment No. Set B Define Employee(id,
3: Inheritance, name, department,
Package and salary). Derive Manager
Collection with bonus. Display
manager with max salary.
56 Assignment No. Set B Construct LinkedList
3: Inheritance, with names: CPP, Java,
Package and Python, PHP. Display
Collection using Iterator &
ListIterator.
57 Assignment No. Set B Create hashtable with
3: Inheritance, employee name and
Package and salary. Search and display
Collection salary of a specific
employee.
58 Assignment No. Set B Create package ‘game’
3: Inheritance, with classes Indoor &
Package and Outdoor. Use display()
Collection and constructors.
59 Assignment No. Set C Create hashtable with city
3: Inheritance, name & STD code. Search
Package and and display STD code of a

8
Collection city.
60 Assignment No. Set C Construct LinkedList
3: Inheritance, with red, blue, yellow,
Package and orange. Add pink & green
Collection between blue and yellow.
61 Assignment No. Set C Define abstract class
3: Inheritance, Staff. Derive
Package and FullTimeStaff and
Collection PartTimeStaff. Display n
staff details.
62 Assignment No. Set C Derive class Square from
3: Inheritance, Rectangle. Create Circle.
Package and Implement area() via
Collection interface. Display area of
all.
63 Assignment No. Set C Create package Series
3: Inheritance, with 3 classes: Fibonacci,
Package and Cube, Square. Display n
Collection terms of each series.
64 Assignment No. Practice Write a Java program to
4: File and Set accept data from user and
Exception write it into a file.
Handling
65 Assignment No. Practice Write a Java program to
4: File and Set display ASCII values of
Exception characters from a file.
Handling
66 Assignment No. Practice Write a Java program to
4: File and Set count digits, spaces, and
Exception characters from a file.
Handling
67 Assignment No. Practice Accept number from user.
4: File and Set If non-zero, check
Exception Armstrong. If zero, throw
Handling “Number is Invalid”.
68 Assignment No. Practice Write a Java program to
4: File and Set check whether given file is
Exception hidden or not.
Handling
69 Assignment No. Practice Write a Java program to
4: File and Set display name and size of
Exception given files.

9
Handling
70 Assignment No. Set A Count number of integers
4: File and from command line
Exception arguments.
Handling
71 Assignment No. Set A Check voting eligibility.
4: File and Handle user-defined and
Exception system exceptions.
Handling
72 Assignment No. Set A Calculate size of a file.
4: File and
Exception
Handling
73 Assignment No. Set A Accept number. If zero,
4: File and throw “Number is Zero”.
Exception If non-numeric, “Number
Handling is Invalid”. Else, check
palindrome.
74 Assignment No. Set A If number > 100, throw
4: File and “Number is out of
Exception Range”. Else, do sum of
Handling digits. Use static keyword.
75 Assignment No. Set B Copy data from one file to
4: File and another. Change case &
Exception replace digits with '*'.
Handling
76 Assignment No. Set B Accept string. Write
4: File and ASCII values of
Exception characters into file.
Handling
77 Assignment No. Set B If number < 5, throw
4: File and “Number is small”; if >
Exception 10, throw “Number is
Handling Greater”. Else, calculate
factorial.
78 Assignment No. Set B Display contents of file in
4: File and reverse order.
Exception
Handling
79 Assignment No. Set B Display each word from
4: File and file in reverse order.
Exception

10
Handling
80 Assignment No. Set C Accept file names via
4: File and command line. Delete all
Exception with .txt extension. Show
Handling name, location, size of
remaining.
81 Assignment No. Set C Display all .txt files from a
4: File and given directory.
Exception
Handling
82 Assignment No. Set C Count number of lines,
4: File and words, and characters in
Exception a file.
Handling
83 Assignment No. Set C Read characters from file.
4: File and If alphabet, reverse case.
Exception Else, display category
Handling (Digit/Space).
84 Assignment No. Set C Validate PAN number and
4: File and Mobile Number. If
Exception invalid, throw “Invalid
Handling Data”. Else, display it.
85 Assignment No. Practice Develop an applet that
5: Applet, AWT, Set draws a centered circle
Event and Swing (radius 100px) in
Programming 500x300px applet and
displays your name in it.
86 Assignment No. Practice Create a frame using
5: Applet, AWT, Set AWT. Implement
Event and Swing mouseClicked(),
Programming mouseEntered(),
mouseExited(). Frame
becomes visible on mouse
enter.
87 Assignment No. Practice Display a string in frame
5: Applet, AWT, Set with pink background.
Event and Swing
Programming
88 Assignment No. Practice Create two buttons “Red”
5: Applet, AWT, Set and “Blue”. Set
Event and Swing background color based
Programming on button pressed.

11
89 Assignment No. Practice Respond to KEY_TYPED
5: Applet, AWT, Set event and display
Event and Swing character typed. Use
Programming adapter class for others.
90 Assignment No. Practice Create buttons ‘GetInfo’
5: Applet, AWT, Set and ‘GetCGPA’. Show
Event and Swing personal info or CGPA
Programming based on button pressed.
91 Assignment No. Set A Ask user’s name and
5: Applet, AWT, greet them in uppercase:
Event and Swing "Hello, NAME, nice to
Programming meet you!"
92 Assignment No. Set A Read one line input and
5: Applet, AWT, print each word on new
Event and Swing line, ignoring
Programming punctuation.
93 Assignment No. Set A Read positive real
5: Applet, AWT, numbers (max 100), sort
Event and Swing and print them. Input
Programming ends with 0.
94 Assignment No. Set A Create an applet to show
5: Applet, AWT, X and Y position of cursor
Event and Swing using mouse/keyboard
Programming listeners.
95 Assignment No. Set A Create a GUI layout using
5: Applet, AWT, appropriate layout
Event and Swing managers.
Programming
96 Assignment No. Set B Implement a simple
5: Applet, AWT, arithmetic calculator with
Event and Swing validations.
Programming
97 Assignment No. Set B Write a GUI program to
5: Applet, AWT, handle button events and
Event and Swing display relevant message.
Programming
98 Assignment No. Set B Create an applet to draw
5: Applet, AWT, a Temple.
Event and Swing
Programming
99 Assignment No. Set B Create applet to display a
5: Applet, AWT, Table Lamp that changes

12
Event and Swing color randomly.
Programming
100 Assignment No. Set B Design email registration
5: Applet, AWT, form using Swing
Event and Swing components.
Programming
101 Assignment No. Set C Accept employee details
5: Applet, AWT, (eno, ename, sal) and
Event and Swing show it on another frame
Programming using events.
102 Assignment No. Set C Display 5 employee
5: Applet, AWT, records (Eno, Ename, Sal)
Event and Swing in JTable.
Programming
103 Assignment No. Set C Change frame color on
5: Applet, AWT, click. On close button,
Event and Swing move frame to a new
Programming position.
104 Assignment No. Set C Display a custom-
5: Applet, AWT, designed GUI screen.
Event and Swing
Programming
105 Assignment No. Set C Write an applet to display
5: Applet, AWT, smiley and sad face.
Event and Swing
Programming

13
Assignment No. 1: Introduction to Java
Practice Set:
1. Write a java Program to check whether given String is Palindrome or not.
2. Write a Java program which accepts three integer values and prints the maximum and
minimum.
3. Write a Java program to accept a number from command prompt and generate multiplication
table of a number.
4. Write a Java program to display Fibonacci series.
5. Write a Java program to calculate sum of digits of a number.
6. Write a Java program to accept a year and check if it is leap year or not.
7. Write a Java program to display characters from A to Z using loop.
8. Write a Java program to accept two numbers using command line argument and calculate
addition, subtraction, multiplication and division.
9. Write a java Program to calculate the sum of first and last digit of a number.
10. Write a java program to calculate the sum of even numbers from an array.
Set A:
1. Write a java Program to check whether given number is Prime or Not.
2. Write a java Program to display all the perfect numbers between 1 to n.
3. Write a java Program to accept employee name from a user and display it in reverse order.
4. Write a java program to display all the even numbers from an array. (Use Command Line
arguments)
5. Write a java program to display the vowels from a given string.

Set B:
1. Write a java program to accept n city names and display them in ascending order.
2. Write a java program to accept n numbers from a user store only Armstrong numbers in an array and
display it.
3. Write a java program to search given name into the array, if it is found then display its index
otherwise display appropriate message.
4. Write a java program to display following pattern:
5
45
345
2345
12345
5. Write a java program to display following pattern:
1
01
010
1010

Set C:

14
1. Write a java program to count the frequency of each character in a given string.
2. Write a java program to display each word in reverse order from a string array.
3. Write a java program for union of two integer array.
4. Write a java program to display transpose of given matrix.
5. Write a java program to display alternate character from a given string.

Assignment No. 2: Classes, Objects and Methods

15
Practice Set:
1. Write a Java program to for the implementation of reference variable.
2. Write a Java program to keep the count of object created of a class. Display the count each
time when the object is created.
3. Write a Java program to convert integer primitive data. (use toString()).
4. Write a Java program to calculate sum of digits of a number using Recursion.
5. Write a Java program to for the implementation of this keyword.

Set A:
1. Write a Java program to calculate power of a number using recursion.
2. Write a Java program to display Fibonacci series using function.
3. Write a Java program to calculate area of Circle, Triangle & Rectangle.(Use Method
Overloading)
4. Write a Java program to Copy data of one object to another Object.
5. Write a Java program to calculate factorial of a number using recursion.
Set B:
1. Define a class person(pid,pname,age,gender). Define Default and parameterised
constructor. Overload the constructor. Accept the 5 person details and display it.(use this
keyword).
2. Define a class product(pid,pname,price). Write a function to accept the product details, to
display product details and to calculate total amount. (use array of Objects)
3. Define a class Student(rollno,name,per). Create n objects of the student class and Display it
using toString().(Use parameterized constructor)
4. Define a class MyNumber having one private integer data member. Write a default
constructor to initialize it to 0 and another constructor to initialize it to a value. Write
methods isNegative, isPositive. Use command line argument to pass a value to the object and
perform the above tests.
Set C:
1. Define class Student(rno, name, mark1, mark2). Define Result class(total, percentage) inside
the student class. Accept the student details & display the mark sheet with rno, name, mark1,
mark2, total, percentage. (Use inner class concept)
2. Write a java program to accept n employee names from user. Sort them in ascending order
and Display them.(Use array of object nd Static keyword)
3. Write a java program to accept details of ‘n’ cricket players(pid, pname, totalRuns,
InningsPlayed, NotOuttimes). Calculate the average of all the players. Display the details of
player having maximum average.
4. Write a java program to accept details of ‘n’ books. And Display the quantity of given book.

16
Assignment No. 3: Inheritance, Package and Collection

Practice Set:
1. Create abstract class Shape with abstract method area().Write a Java program to calculate are
of Rectangle and Triangle.(Inherit Shape class in classes Rectangle and Triangle )
2. Create a class Teacher(Tid, Tname, Designation, Salary, Subject). Write a Java program to
accept the details of ‘n’ teachers and display the details of teacher who is teaching Java
Subject.(Use array of Object)
3. Create a class Doctor(Dno, Dname, Qualification, Specialization). Write a Java program to
accept the details of ‘n’ doctors and display the details of doctor in ascending order by doctor
name.
4. Write a Java program to accept ‘n’ employee names through command line, Store them in
vector. Display the name of employees starting with character ‘S’.
5. Create a package Mathematics with two classes Maximum and Power. Write a java program
to accept two numbers from user and perform the following operations on it:
a. Find Maximum of two numbers.
b. Calculate the power(XY);

Set A:
1. Write a java program to calculate area of Cylinder and Circle.(Use super keyword)
2. Define an Interface Shape with abstract method area(). Write a java program to calculate an
area of Circle and Sphere.(use final keyword)
3. Define an Interface “Integer” with a abstract method check().Write a Java program to check
whether a given number is Positive or Negative.
4. Define a class Student with attributes rollno and name. Define default and parameterized
constructor. Override the toString() method. Keep the count of Objects created. Create
objects using parameterized constructor and Display the object count after each object is
created.
5. Write a java program to accept ‘n’ integers from the user & store them in an ArrayList
collection. Display the elements of ArrayList collection in reverse order.
17
Set B:
1. Create an abstract class Shape with methods calc_area() & calc_volume(). Derive two classes
Sphere(radius)& Cone(radius, height) from it. Calculate area and volume of both. (Use
Method Overriding)
2. Define a class Employee having private members-id, name, department, salary. Define
default & parameterized constructors. Create a subclass called Manager with private member
bonus. Define methods accept & display in both the classes. Create n objects of the manager
class & display the details of the manager having the maximum total salary(salary+bonus).
3. Construct a Linked List containg name: CPP, Java, Python and PHP. Then extend your
program to do the following:
i. Display the contents of the List using an iterator
ii. Display the contents of the List in reverse order using a ListIterator.
4. Create a hashtable containing employee name & salary. Display the details of the hashtable.
Also search for a specific Employee and display salary of that employee.
5. Write a package game which will have 2 classes Indoor & Outdoor. Use a function display()
to generate the list of player for the specific game. Use default & parameterized constructor.
Set C:
1. Create a hashtable containing city name & STD code. Display the details of the hashtable.
Also search for a specific city and display STD code of that city.
2. Construct a Linked List containing name: red, blue, yellow and orange. Then extend your
program to do the following:
Display the contents of the List using an iterator
Display the contents of the List in reverse order using a ListIterator.
Create another list containing pink & green. Insert the elements of this list between blue &
yellow.
3. Define an abstract class Staff with members name &address. Define two sub classes
FullTimeStaff(Departmet, Salary) and PartTimeStaff(numberOfHours, ratePerHour). Define
appropriate constructors. Create n objects which could be of either FullTimeStaff or
PartTimeStaff class by asking the user’s choice. Display details of FulltimeStaff and
PartTimeStaff.
4. Derive a class Square from class Rectangle. Create one more class Circle. Create an interface
with only one method called area(). Implement this interface in all classes. Include
appropriate data members and constructors in all classes. Write a java program to accept
details of Square, Circle & Rectangle and display the area.
5. Create a package named Series having three different classes to print series:
i. Fibonacci series
ii. Cube of numbers
iii. Square of numbers
Write a java program to generate ‘n’ terms of the above series.

18
Assignment No. 4 : File and Exception Handling
Practice Set:
1. Write a java program to accept the data from a user and write it into the file.
2. Write a java program to display ASCII values of the characters from a file.
3. Write a java program to count number of digits, spaces and characters from a file.
4. Write a java program to accept a number from user if it is non-zero then check whether it is
Armstrong or not, otherwise throws user defined Exception “Number is Invalid”.
5. Write a java program to check whether given file is hidden or not.
6. Write a java program to display name and size of the given files.

Set A:

1. Write a java program to count the number of integers from a given list.(Use command line
arguments).
2. Write a java program to check whether given candidate is eligible for voting or not.
Handle user defined as well as system defined Exception.
3. Write a java program to calculate the size of a file.
4. Write a java program to accept a number from a user, if it is zero then throw user defined
Exception “Number is Zero”. If it is non-numeric then generate an error “Number is Invalid”
otherwise check whether it is palindrome or not.
5. Write a java program to accept a number from user, If it is greater than 100 then throw user
defined exception “Number is out of Range” otherwise do the addition of digits of that
number. (Use static keyword)

Set B:
1. Write a java program to copy the data from one file into another file, while copying change
the case of characters in target file and replaces all digits by ‘*’ symbol.
2. Write a java program to accept string from a user. Write ASCII values of the characters from
a string into the file.
3. Write a java program to accept a number from a user, if it less than 5 then throw user defined
Exception “Number is small”, if it is greater than 10 then throw user defined exception
“Number is Greater”, otherwise calculate its factorial.

19
4. Write a java program to display contents of a file in reverse order.
5. Write a java program to display each word from a file in reverse order.

Set C:

1. Write a java program to accept list of file names through command line. Delete the files
having extension .txt. Display name, location and size of remaining files.
2. Write a java program to display the files having extension .txt from a given directory.
3. Write a java program to count number of lines, words and characters from a given file.
4. Write a java program to read the characters from a file, if a character is alphabet then reverse
its case, if not then display its category on the Screen. (whether it is Digit or
Space)
5. Write a java program to validate PAN number and Mobile Number. If it is invalid then throw
user defined Exception “Invalid Data”, otherwise display it.

20
Assignment No. 5: Applet, AWT, Event and Swing Programming

Practice Set:
1. Develop an applet that draws a circle. The dimension of the applet should be 500 * 300 pixels
the circle should be centered the applet and have a radius of 100 pixels. Display your name
centered in a circle(using drawOval() method)
2. Write a program to create a frame using AWT. Implement mouseClicked(), mouseEntered()
and mouseExited() events. Frame should become visible when mouse enters it.
3. Write a program to display a string in frame window with pink colour as background.
4. Write a program to create two buttons named “Red” and “Blue”. When a button is pressed the
background colour should be set to the colour named by the button’s label.
5. Write a program which responds to KEY_TYPED event and updates the status window with
message (“Typed character is: X”). Use adapter class for other two events.
6. Write a program to create two buttons labeled ‘GetInfo’ and ‘GetCGPA’. When button
‘GetInfo’ is pressed, it displays your personal information (Name, Course, Roll No, College)
and when button ‘GetCGPA’ is pressed, it displays your CGPA in previous semester.

Set A:
1. Write a program that asks the user's name, and then greets the user by name. Before
outputting the user's name, convert it to upper case letters. For example, if the user's name is
Raj, then the program should respond "Hello, RAJ, nice to meet you!".
2. Write a program that reads one line of input text and breaks it up into words. The words
should be output one per line. A word is defined to be a sequence of letters. Any characters in
the input that are not letters should be discarded. For example, if the user inputs the line He
said, "That's not a good idea." then the output of the program should be He
said thats
not
a
good idea
3. Write a program that will read a sequence of positive real numbers entered by the user and
will print the same numbers in sorted order from smallest to largest. The user will input a
zero to mark the end of the input. Assume that at most 100 positive numbers will be entered.
4. Create an Applet that displays the x and y position of the cursor movement using Mouse and
Keyboard. (Use appropriate listener).
5. Create the following GUI screen using appropriate layout managers.

21
Set B:
1. Write a java program to implement a simple arithmetic calculator. Perform appropriate
validations.

2. Write a java program to implement following. Program should handle appropriate events.

3. Write an applet application to draw Temple.

4. Write an applet application to display Table lamp. The color of lamp should get
change in random color.
5. Write a java program to design email registration form.( Use maximum Swing component in
form).

Set C:
1. Write a java program to accept the details of employee employee eno,ename, sal and display
it on next frame using appropriate even .

22
2. Write a java program to display at least five records of employee in JTable.( Eno,
Ename ,Sal).
3. Write a java Program to change the color of frame. If user clicks on close button then the
position of frame should get change.
4. Write a java program to display following screen.

5. Write an applet application to display smiley and sad face.

23
1

You might also like