0% found this document useful (0 votes)
8 views9 pages

Java Programming Assignments Overview

The document outlines a series of Java programming assignments divided into five sets, each focusing on different aspects of Java such as basic programming, classes and objects, inheritance, file handling, and GUI development. Each set contains multiple tasks that require writing Java programs to solve specific problems, implement concepts, and demonstrate understanding of Java programming principles. Additionally, there are evaluation criteria for each assignment to assess the completion and quality of the work.

Uploaded by

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

Java Programming Assignments Overview

The document outlines a series of Java programming assignments divided into five sets, each focusing on different aspects of Java such as basic programming, classes and objects, inheritance, file handling, and GUI development. Each set contains multiple tasks that require writing Java programs to solve specific problems, implement concepts, and demonstrate understanding of Java programming principles. Additionally, there are evaluation criteria for each assignment to assess the completion and quality of the work.

Uploaded by

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

Assignment No.

1: Introduction to Java
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:

45

345

2345

12345

5. Write a java program to display following pattern:

01

0 10

1 010

Set C:

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 Evaluation

0: Not Done [ ] 1: Incomplete [ ] 2: Late Complete [ ]

3: Needs Improvement [ ] 4: Complete [ ] 5: WellDone [ ]

Signature of Instructor
Assignment No. 2: Classes, Objects and Methods
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.

Assignment Evaluation:

0: Not Done [ ] 1: Incomplete [ ] 2: Late Complete [ ]

3: Needs Improvement [ ] 4: Complete [ ] 5: WellDone [ ]

Signature of Instructor
Assignment No. 3: Inheritance, Package and Collection
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.

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.

Assignment Evaluation:

0: Not Done [ ] 1: Incomplete [ ] 2: Late Complete [ ]

3: Needs Improvement [ ] 4: Complete [ ] 5: WellDone [ ]

Signature of Instructor
Assignment No. 4 : File and Exception Handling
Set A:

[Link] a java program to count the number of integers from a given list.(Use command line
arguments).

[Link] a java program to check whether given candidate is eligible for voting or not.

Handle user defined as well as system defined Exception.

[Link] a java program to calculate the size of a file.

[Link] 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.

[Link] 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:

[Link] 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.

[Link] a java program to accept string from a user. Write ASCII values of the characters from a string
into the file.

[Link] 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.

[Link] a java program to display contents of a file in reverse order.

[Link] 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.

[Link] a java program to display the files having extension .txt from a given directory.

[Link] a java program to count number of lines, words and characters from a given file.

[Link] 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)

[Link] a java program to validate PAN number and Mobile Number. If it is invalid then throw user
defined Exception “Invalid Data”, otherwise display it.
Assignment Evaluation:

0: Not Done [ ] 1: Incomplete [ ] 2:


Late Complete [ ]

3: Needs Improvement [ ] 4: Complete [ ] 5:


WellDone [ ]

Signature of Instructor
Assignment No. 5: Applet, AWT, Event and Swing
Programming
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.

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 .

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.

Assignment Evaluation:

0: Not Done [ ] 1: Incomplete [ ] 2: Late Complete [ ] 3: Needs


Improvement [ ] 4: Complete [ ] 5: WellDone [ ]

Signature of Instructor

You might also like