Please, In java. Thank you
Objectives The purpose of this lab is to reinforce stack concepts in Java Assignment 04 - PART 1 Stacks (50 points) - Note Part 1 is a separate dellvorable: In some other applications, we might need two stacks with the same fype of data. If we implement the stacks as arrays, there is a chance that one array (and hence one stack) becomes filled, causing our computation to end prematurely. This might be a shame, since the other artay (stack) might have plenty of room. One way around this problem is to implement two stacks as one large array rather than two smaler arrays YOU MUST WRIE YOUR OWN Stack Class For Part 1 - do not use the Java Library, Stack Class Requirements No tiles are provided with any part of this Assignment. Assume you need two stacks with the same type of data. If you implement the stacks as arrays, there: is a chance that one array (and hence one stack) will become filled, causing our computation to end prematurely. This might be a shame since the other array (stock) might have plenty of room. One way around this problem is to implement two stacks as one large array rather than fwo smaller arrays (stacks). Write a ciass for a pair of stacks. A pair of stacks is simply an object with two stacks. Call these ntacks: Stacka and Staci8. You need separate methods for each stack: pop a and pop b
StackA and StackB. You need separate methods for each stack: pop_a and pop_ \( b \) push_a and puah_b is_empty_a and is_erpty_b is_full If room in the array there's root for elther a or \( b \) Variables will be needed to keep track of the fop of each stack, call them top_a and top b impiement the stack poir as a single array. The two stacks grow from the two ends of the atray, so for example, one stack could fili up one quarter of the array, while the other fiss up three quatters. Use int for the underlying fype of the stack data. If the amay runs out of room, print a statement to the screen that the array is full and end the program. Testing In order to test your stack pair, write the main method in the dass, that wal puah a few values onto the stacka , then push a few values onto stacki . The program should pop the values on stacks and check that they are correct as they are popped. The program should pop the values on stacks and check that they are correct as they are popped. Part 1 requires user input input data for stank, and then some for stackA and then pont both Then delete something from each stack and pirt again.
on stacks and check that they are correct as thoy are popped. Part 1 requires user input. Input data for stacks, and then some for stacka and then print both. Then delete something from each stack and print again. HINT: 1. You can write all of this in one class file (vanable declarations, constructors, methods. including main method) 2. Methods are contained in a ciass. To run a Java program, the progrom must have a main method (see method header beiow). pubic stase void mainfsing argspi The main method is the entry point where the program starts when it is executed. For this exercise, add your main method at the botoen of your class file.