Write Java code that gives a simple demonstration of how a set of student registration requests is processed in a department of a college. It accepts a specific number of seats as input, and prints whether the registration is successful or not, based on the remaining seats left. The code uses the concept of inner classes, and has the following components:
Registerable has an abstract method register().Department with:
name (String) representing the department nameDeptEnquiry that has/does the following:
reqseats, avalseats as instance variables that hold the number of requested seats and available seats, respectively.Registerable (whose method register returns a string that describes whether registration is successful or not), which enables its object to be accessible from outside the class Department.public String register() checks whether avalseats is less than reqseats. If it is less, then it returns Cannot register, else it returns Registered successfully available seats are <available seats>.enrollRequest(int) that takes the number of seats to be registered as an argument and returns a Registerable object on which method register() can be invoked.Student has method main that does the following:
Department with the name DCSE. Using this object, it invokes method enrollRequest to obtain a Registerable object, and invokes method register on it.What you have to do:
enrollRequest() in class DepartmentWrite Java code that gives a simple demonstration of how a set of student registration requests is processed in a department of a college. It accepts a specific number of seats as input, and prints whether the registration is successful or not, based on the remaining seats left. The code uses the concept of inner classes, and has the following components: - Interface `Registerable` has an abstract method `register()`. - Class `Department` with: - Instance variable `name` (`String`) representing the department name - Constructor to initialize the instance variable - An inner private class `DeptEnquiry` that has/does the following: - `reqseats`, `avalseats` as instance variables that hold the number of requested seats and available seats, respectively. - Implements interface `Registerable` (whose method `register` returns a string that describes whether registration is successful or not), which enables its object to be accessible from outside the class `Department`. - Constructor to initialize the instance variables - Method `public String register()` checks whether `avalseats` is less than `reqseats`. If it is less, then it returns `Cannot register`, else it returns `Registered successfully available seats are <available seats>`. - Method `enrollRequest(int)` that takes the number of seats to be registered as an argument and returns a `Registerable` object on which method `register()` can be invoked. - Class `Student` has method `main` that does the following: - Creates an object of `Department` with the name `DCSE`. Using this object, it invokes method `enrollRequest` to obtain a `Registerable` object, and invokes method `register` on it. What you have to do: - Define method `enrollRequest()` in class `Department` An employee portal records the number of requests raised by employees in different request categories (such as Leave, Payroll, and IT Support). Given a list of request records, write a Java program to compute the total number of requests for each category. Complete the program as specified below. Class `RequestRecord` has the following members: - Private instance variables: `String category` and `int count` - A constructor to initialize the instance variables - Method `getCategory` that returns the request category - Method `getCount` that returns the request count Class `EmployeePortal` has/should have the following members: - Define method `aggregateRequestsByCategory` that takes a `List<RequestRecord>` and returns a `Map<String, Integer>` with category names as keys and total request counts as values, in the order in which the categories first appear. - `main` method that does the following: - Accepts input to instantiate 5 `RequestRecord` objects. The input is accepted in the order: category, count. - Adds the records to a `List<RequestRecord>` object - Invokes method `aggregateRequestsByCategory` - Prints each category along with the total number of requests What you have to do: - Define method `aggregateRequestsByCategory` in class `EmployeePortal`.