*java IDE
Dear student, according to the question, the resultant programs are as follows:
Recursive method to Print the Last Value in Stack:
/* Java program to print last value in the stack
*/
class Stack
{
static final int SIZE = 10;
int top;
int a[] = new int[SIZE]; // Maximum size of Stack
Stack() // default constructor to initialize top
value
{
top = -1;
}
void push(int x) // to push value onto
stack
{
if (top >= (SIZE-1))
{
System.out.println("Stack Overflow");
}
else
{
a[++top] =
x;
System.out.println("element "+ x + " pushed into stack");
}
}
int pop()
{
if (top < 0)
{
System.out.println("Stack Underflow");
return 0;
}
else
{
int x =
a[top--];
return x;
}
}
int lastValueInStack(int top) // considering top vaue to get the
last value
{
int r;
if(top == 0) // the last value has been stored onto stack at top =
0.
return pop();
else
r = pop();
return lastValueInStack(top-1); // So keep on recursivelly calling
till we get top value as 0
}
}
// Main code
class Main
{
public static void main(String args[])
{
Stack s = new Stack();
s.push(1);
s.push(10);
s.push(20);
s.push(30);
System.out.println(s.lastValueInStack(s.top) + " is
the last value from stack");
}
}
Output:

Write a recursive method to print the last value in a stack Write a recursive method...
Create two Java classes called Recursive, RecursiveDemo. Write four methods a- int sum_sqr_rec(stack<int> stk) which will receive a stack of "int" and output the sum of the squares of the elements in the stack. b- int plus_minus_rec(stack<int> stk) which will receive a stack of "int" (example: {a,b,c,d,e,f,g,h,i,j}) and output the sum of the elements in the stack as follows: a - b + c - d + e - f + g - h + i -j c- void prt_chars_rev_rec(stack<char>...
Using Java IDE Write a recursive method which takes an integer number and returns the sum of the numbers from 1 to that number. The method must solve the problem recursively.Then write an application which calls the method with a few different numbers and displays the return value of the method.
In Java, write a recursive method that converts an integer to hexadecimal. The function should print out the hexadecimal character instead of returning the character. Write a test program that prompts the user to enter an integer and displays its hexadecimal equivalent.
1. a. Stack b. Queue c. Priority Queue d. List - (ADTs) Given the following steps: push( "Jane" ); push( "Jess" ); push( "Jill" ); push( pop() ); push( "Jim" ); String name = pop(); push( peek() ); Write separate programs for each of the data structures Stack, Queue, PriorityQueue, and List. Use the appropriate push(), pop(), peek() for each of the respective ADT's. Use the Java class library of the ADT's as opposed to the author's implementation. What is in...
JAVA Write a recursive method that writes a given array backward. Consider the last element of the array first.
Using java Create a simple queue class and a simple stack class. The queue and stack should be implemented as a linked list. Create three functions that utilize these data structures Write a function that opens a text file and reads its contents into a stack of characters. The program should then pop the characters from the stack and save them in a second text file. The order of the characters saved in the second file should be the reverse...
Create a Stack class based on java.util.LinkedList class. Your Stack class should have a push(), pop(), peek(), and isEmpy() methods. Create a new Java Application that has the following methods. Write a method reverseChar() to print a sentence in reverse order. Use a Stack to reverse each character. Example: if the user enters a sentence “ABC DEFG”, the program will display “GFED CBA” Write a method reverseWord() to print a sentence reverse order. Use a Stack to reverse each word....
Please use Java. Write a non-recursive method that uses a stack to check whether its string parameter is a palindrome. Write a program to test and demo your method. Fibonacci Numbers Write a method that uses a stack to determine the desired Fibonacci number. Write a program to test and demo your method. Balancing Grouping Symbols Write a method that takes a string parameter and determines whether the string contains matching grouping symbols. Grouping symbols are parenthesis ( ), curly...
Write in Java (10 pts) Write a public method named “Even_Sum” that accepts a one-dimensional array of integers and returns the sum of the even elements in the array (10 pts) Write a public method named “Reverse” that receives a string prints its contents in reverse to the standard output using a stack. Assume the stack has been created and is empty.
Create a Stack class based on java.util.LinkedList class. Your Stack class should have a push(), pop(), peek(), and isEmpy() methods. Create a new Java Application that has the following methods. Write a method reverseChar() to print a sentence in reverse order. Use a Stack to reverse each character. Example: if the user enters a sentence “ABC DEFG”, the program will display “GFED CBA” Write a method reverseWord() to print a sentence reverse order. Use a Stack to reverse each word....