Professional Documents
Culture Documents
b. Create a class LenthySeq with an array that stores the length of the hailstone seq for
numbers from 1 to 100. Identify the lengthiest hailstone sequence by inheriting the Number
class.
c. Create a LinkedList to add each number in a sequence to the end of the list. Display the
linked list in both forward and reverse order.
2. Create database of the student with the details such as (name, registernumber, cgpa, age,
dayscholar/hosteller).
Create a class student with the needed attributes. Use array of objects to store ‘n’ number
of students’ details into the database.
Write a java program to fetch the following details from the database.
a. List of students whose joined in 2018.
b. List of students whose age is between 18-20
c. List of students with CGPA less than 5.
d. List of students who stay in hostel.
e. List of 2019 batch students who are dayscholars.
3. a. Create a file for storing the book details as objects [booknum (int), name (String),
price (float), stack/reference (char), textbook (Boolean)] read from the user. Write a java
program to read the file and
b. Write a search function to search for a book with booknum or name. Raise an
Exception if the book details are not found.
c. Write a method sort to display the book details in sorted order with respect to price.
d. Write a method Extract to textbooks and reference books separately in 2 separate set.
4. Assume husband and wife have a joint account in the bank. An amount of Rs.25000 is
credited to the account as salary. They do shopping individually with the same account.
Synchronize the shopping of both such that the balance in the account does not go below
5000. If the shopping expense reaches the base limit. Raise an exception to both.