Question: I could use some help with this Java project, I am new to stacks! Thank you!! Assignment Description This assignment provides the opportunity to implement








I could use some help with this Java project, I am new to stacks!
Thank you!!
Assignment Description This assignment provides the opportunity to implement and use a generic class (ADT) as well as generic methods. The goal: combine two sorted stacks (min value on top) into one sorted stack (min value on top). The code must work for any 2 sorted stacks. The picture shows 2 stacks of integers being merged Stack1 Stack2 12 MergedStack 10 17 30 81 10 12 17 29 37 42 62 29 30 37 42 62 81 In this assignment, first work from the developer perspective and create a generic class (abstract data type) for the stack. Once the ADT is implemented, work from the user perspective (Assignment4 class code) and use the ADT methods to push objects of type Integer onto 2 stacks then objects of type String. Finally, write the generic methods to merge the two stacks, reverse a stack, and print the objects in a stack. Calls to these methods merge the two stacks into one merged stack that is ordered Specifications 1. Create a Java class called UsernameAssignment5 (include username) 2. Follow "CS1450 Programming Assignments Policy" 3. Write a test program (i.e. main) that performs the following a. Create 2 GenericStack objects of type Integer (later repeat all these steps for String) i. See definition of GenericStack class below that you need to create b. Fill the 2 GenericStacks with values read from a file i. Read values in integers1.txt - display each value after it is read ll. Store values in 1st GenericStack-stack! ii. Read values in integers2.txt - display each value after it is read iv. Store values in 2nd GenericStack-stack2 After all values are pushed onto stack 1 & stack 2, call generic method mergeStacks i. First create 1 GenericStack object of type Integer (this is the mergedStack) c
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
