Question: Software Dev. & Problem Solving II GCIS-124 Unit 5 Review Assignment 6.1 Goals of the Assignment The goal of this assignment Is to give you

 Software Dev. & Problem Solving II GCIS-124 Unit 5 Review Assignment6.1 Goals of the Assignment The goal of this assignment Is to

Software Dev. & Problem Solving II GCIS-124 Unit 5 Review Assignment 6.1 Goals of the Assignment The goal of this assignment Is to give you an opportunity to practice writing solutions to problems that are similar to those that you will see on a practical exam. Please read this document in its entirety before seeking help from the course staff. Activities > 1. Create a new stack ADT, using the UML to the right as a Stack guide. + size(): int + top(): int + push(value: int) + pop(): int 2. Create an array based implementation of the Stack ADT. Stack Each time you create a new method you should test it, either + size0) int manually in main or using a JUnit test (preferred). Use the + top(): int + push(value: int] UML to the right as a guide where: + pop(): int a. size returns the number of elements in a stack. A b. top rotums the value of the top element in the stack. ArrayStack -elements, in0 C. push adds a value to the top of the stack. - size: int d. pop removes and returns the value at the top of the + ArraySlack0 + toString(): String stack. + size[: int + top: in e. toString retums the elements in the stack + push(value: int] + pop(: int formatted as " [, , ... ]"> Stack interface. 4 5. Use the Array Iterator class we developed in the last ArrayStack class to implement the iterator method in ArrayStack. elements: Objectl Test that It works by using an Arraystack In a for each size; int loop. + ArrayStack() 6. Bonus (10%) - Write a new ReverseArray Iterator that + toString (): String + size(): int will iterate through the array In reverse order. Then use It in + top(): E the Iterable implementation of the ArrayStack. I.E. + push(value: E) Make it iterate from top to bottom instead of the bottom to + popp: E top as the in-class Iterator does. The final UML (minus the bonus) is provided below as a reference. You do not need to use it but you may find it useful as a guide for parts 4 and 5. > > Iterable=E> Iterator E> + iteratorg: Iterator + hasNext(: boolean + next[: E 4 > Stack ArrayitoratorsE> + size(): int - elements: Object + top(: E - size: int + push (value: E) - index: int + popp): E + Arrayiterator( A elements: Object[, size: int) + hasNext(): boolean + next0: E ArrayStack - elements: Objectl - size: int + ArrayStack0 + toString(): String + size(): int + top(: E + push(value: E) + pop(): E + iterator(: ArrayIterator

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 Programming Questions!