0% found this document useful (0 votes)
2 views

Week9 Tutorial Assignment

Uploaded by

Aghaash
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)
2 views

Week9 Tutorial Assignment

Uploaded by

Aghaash
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
You are on page 1/ 2

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY FACULTY OF ENGINEERING

AND TECHNOLOGY
SCHOOL OF COMPUTING
DEPARTMENT OF COMPUTATIONAL INTELLIGENCE
21CSC203P ADVANCED PROGRAMMING PRACTICE

Week 9 - Graphical User Interface Based Programming Paradigm


&
Functional Programming Paradigm

1.Create a GUI application that simulates a simple library management system.


Requirements:
• Main Window:
➢ A JFrame with a clear layout (e.g., BorderLayout, GridLayout).
➢ A JMenuBar with menus for "File", "Edit", and "Help".
➢ A JToolBar containing buttons for common actions (e.g., add book, remove book,
search).
➢ A JTabbedPane to organize different panels.
• Book Details Panel:
o A JPanel with:
➢ JTextFields for book title, author, ISBN, and publication year.
➢ JComboBox for genre.
➢ JCheckBox for availability.
➢ Buttons for "Add Book" and "Update Book".
• Book List Panel:
➢ A JScrollPane containing a JTable to display a list of books.
➢ Columns should include book title, author, ISBN, genre, and availability.
➢ A search bar (JTextField) and a search button.
• Dialog Boxes:
➢ A JDialog for confirming actions (e.g., deleting a book).
➢ A JDialog for displaying error messages.
Additional Considerations:
➢ Use appropriate data structures (e.g., ArrayList, HashMap) to store book information.
➢ Implement event handling for buttons, menus, and table interaction
Functional Programming Paradigm

2.Pure Function: Create a pure function to calculate the area of a circle, given its radius.
Impure Function: Create an impure function to prompt the user for the radius of a circle and print
its area.

3. Pure Function: Create a pure function to find the maximum value in a list of numbers.
Impure Function: Create an impure function to sort a list of numbers in ascending order.

4. Create a function to manage a list of student records, where each record includes name, age, and
grade.
Questions:
1. Mutable Function: Create a mutable function to add a new student to the list of records.
2. Immutable Function: Create an immutable function to find the average age of all students
in the list.
5. Mutable Function: Create a mutable function to update the balance of a bank account.
Immutable Function: Create an immutable function to calculate the interest earned on a bank
account.

6. Anonymous Function: Create an anonymous function to add two numbers and immediately
call it with the values 5 and 3.
Anonymous Function : Create an anonymous function to multiply two numbers and assign it to
a variable. Call the function with the values 4 and 6 and print the result.

7. Anonymous Function: Create an anonymous function to square each element in a list and apply
it to the list [1, 2, 3, 4].
Anonymous Function: Create an anonymous function to filter even numbers from a list and
apply it to the list [1, 2, 3, 4, 5, 6].

8. Map: Create a new list containing the employee names and their corresponding salaries.
Filter: Filter the employees who belong to a specific department.
Reduce: Calculate the average salary for employees in each department.

9. Map: Create a new list containing only the names of the students.
Filter: Filter the students who are above a certain age threshold.
Reduce: Calculate the average grade of all students.

You might also like