Question: 2 # Task Implement a generic queue class called GenericQueue that supports the following operations: enqueue ( T item ) : Adds an item to

2# Task
Implement a generic queue class called GenericQueue that supports the following
operations:
enqueue(T item): Adds an item to the rear of the queue.
dequeue(): Removes and returns the item at the front of the queue.
isEmpty(): Returns true if the queue is empty, false otherwise.
size(): Returns the number of items currently in the queue.
Write a test program to demonstrate the usage of the GenericQueue class by
enqueueing and dequeueing items of various types including a Money class having
two attributes amount and currency and also override equals and other necessary
required methods to support the data structure.1# What is functional programming and define its core concepts ?
2# Task
Implement a generic queue class called GenericQueue that supports the following operations:
enqueue(T item): Adds an item to the rear of the queue.
dequeue(): Removes and returns the item at the front of the queue.
isEmpty(): Returns true if the queue is empty, false otherwise.
size(): Returns the number of items currently in the queue.
Write a test program to demonstrate the usage of the GenericQueue class by enqueueing and dequeueing items of various types including a Money class having two attributes amount and currency and also override equals and other necessary required methods to support the data structure.
3# Task
Implement a generic stack class in Java. The stack should support the following operations:
push(T item): Pushes an item onto the top of the stack.
pop(): Removes and returns the item at the top of the stack.
peek(): Returns the item at the top of the stack without removing it.
isEmpty(): Returns true if the stack is empty, false otherwise.
size(): Returns the number of items currently in the stack.
Write a test program to demonstrate the usage of the GenericQueue class by enqueueing and dequeueing items of various types.
4# Task
Implement an application that utilizes functional interfaces in Java.
Your task consists of the following steps:
Define a functional interface called MathOperation that represents a mathematical operation on two integers. This interface should have a single method called operate that takes two integers as input and returns an integer result.
Implement four classes, each representing a different mathematical operation: addition, subtraction, multiplication, and division. Each class should implement the MathOperation interface and provide the corresponding operation logic in the operate method.
Write a class called Calculator that contains a method named performOperation. This method should accept two integers and a MathOperation object as parameters and should execute the operation represented by the MathOperation object on the two integers.
In the Calculator class, write a method called calculate, which takes two integers, a MathOperation object, and an operation name as parameters. This method should output the result of the operation with a suitable message.
Create a generic method that should accept more than three generic parameters and show example with String and Integer
Write a simple Start program to demonstrate the usage of the Calculator class. The Start program should create instances of the Calculator class and the four different mathematical operation classes. It should then use the calculate method to perform various calculations and print the results.
2 # Task Implement a generic queue class called

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!