0% found this document useful (0 votes)
0 views2 pages

Java Assignment 4

The document outlines a series of programming assignments in Java, focusing on exception handling, collections, and data structures. It includes tasks such as demonstrating try-catch blocks, creating a custom exception for bank account management, performing operations on Array Lists, stacks, and linked lists, as well as using maps to manage book objects. Each assignment requires implementing specific functionalities like adding, removing, modifying, and displaying data, along with sorting and conditional updates.

Uploaded by

darshandb941
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)
0 views2 pages

Java Assignment 4

The document outlines a series of programming assignments in Java, focusing on exception handling, collections, and data structures. It includes tasks such as demonstrating try-catch blocks, creating a custom exception for bank account management, performing operations on Array Lists, stacks, and linked lists, as well as using maps to manage book objects. Each assignment requires implementing specific functionalities like adding, removing, modifying, and displaying data, along with sorting and conditional updates.

Uploaded by

darshandb941
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/ 2

Assignments 3 -Package

E xception

1) Write a program to demonstrate the use of try, catch, finally throw and
throws keywords and demonstrate the following points in the program.
a) Multiple catch blocks.
b) try-catch-finally combination.
c) try-finally combination.
d) Nested try blocks

2). Write a java application for checking the bank account funds using
InsufficientFundsException using user defined exception using throw keword
and create a class for CheckingAccount with methods withdraw() and
getBalance() Among these withdraw() should throw an
InsufficientFundsException.

Collection

1.) Write a java program to do following operations on Array List(Integer)


a) Add element
b) Remove a particular element
c) Modify
d) View All elements(Use Iterator)
e) View a Particular element (get() )
f) Sort (Collections.sort)

2) Write a Java menu driven program to perform the following operations-


using Array List Create a class called Player with the following instance
variable

Player name
total run
no of wicket
no of matches
country
no-of-century
Category = null

* Create 5 Players add into the Array List


* Display the player details who has scored maximum no of runs
* Sort the players by name
* Remove the player who has scored less than 100 runs
* Update Category ‘A’ if player has got 10 century else update Grade ‘ B’
3.Write a java program to do push, pop , display objects on stacks(integer).

4.Implement single linked list(Integer) with following options:


a. Insert at the beginning.
b. Insert at given position.
c. Insert after a given node.
d. Delete at the beginning.
e. Delete at given position.
f. Delete after a given node.
g. Reverse the linked list.

2) Write a Java program menu driven to perform the following operations


using Map

* Create a class called Book with the following instance variable

name
price
author name
isbn no;
publication

* Create 5 Objects of book class


* Add all the object in to the Map using key as integer(book id) and value as
Book Object
* Display all the map object using for each
* Read any key from the user and display the particular book object based on
key
* Reduce the price by 10% for a particular publication books and display all
object with reduced price.

You might also like