Write a Java class named GenericStack that implements a gene…

Write a Java class named GenericStack that implements a generic stack. The stack should use an array internally to store its elements. Assume the stack has a fixed capacity limit, which will not be exceeded during operations. Your implementation should include the following methods: A constructor to initialize the stack. push(): Adds an item to the top of the stack. pop(): Removes and returns the item from the top of the stack. Throw an IllegalStateException if the stack is empty. peek(): Returns the item on the top of the stack without removing it. Throw an IllegalStateException if the stack is empty. isEmpty(): Returns true if the stack is empty, otherwise false. isFull(): Returns true if the stack is full, otherwise false. You may use the following line of code in your constructor to initialize the array: elements = (T; Example Usage: GenericStack stack = new GenericStack(5); stack.push(10);  stack.push(20);  System.out.println(stack.peek()); // Output: 20  System.out.println(stack.pop());  // Output: 20  System.out.println(stack.isEmpty()); // Output: false   Notes: You do not need to implement dynamic resizing. Ensure your code is efficient and follows Java best practices.

Given the following UML diagram for the Calculator class, an…

Given the following UML diagram for the Calculator class, and the implementation of the add() and sub() methods, implement two JUnit test cases to test the functionality of the add() and sub() methods. Use the appropriate JUnit annotations and include multiple test cases to verify different scenarios for each method. public static int add(int a, int b) {   return a + b; }public static int sub(int a, int b) {   return a – b; }