Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Stack Applications Stack Applications In this lab we will write an application which uses a Stack ADT. The textbook code provides two implementations of Stacks, two using arrays (a bounded Stack and an unbounded Stack) and one using a Linked List. We'll start with using an array implementation of a Stack, and when our application is working, it will be easy to switch to using the Linked List implementation. 0.  Download the files.  Note that these files have been "flattened," that is all the import and package statements pertaining to the book files in ch02 have been removed, so all the files can be compiled and edited in the same folder: ArrayBoundedStack.java LinkedStack.java LLNode.java StackInterface.java StackOverflowException.java StackUnderflowException.java Stack Application to Track Integer Bids You will write an application which prompts the user for an integer "bid." Create a new file,TDBidArrayStack.java for this application. If the current bid input is larger than the highest bid, then it should be saved on a stack. If the current bid is less than the highest bid, it can be ignored. The input can conclude when the user enters a noninteger input. You can use the Scanner class with both hasNextInt() and nextInt() methods for input, with a while loop. To declare and instatiate the Stack object, you can use: StackInterface bidStack; bidStack = new ArrayBoundedStack (); Note how the general StackInterface is used, with the < > type, and then the declaration is made with the particular implementation, in this case a bounded Array, of the Stack. When the input has concluded, you should print out a history of the highest bid, in descending order. You will make use of the Stack methods push(), pop(), top(), and isEmpty(). Their functionality will be what you expect, based on the discussion in class and in Chapter 02 your textbook. When you have this code functioning, you should copy it to a new file called TDBidLLStack.java in the same directory.  Make the few minor changes so that it uses the LinkedStack implementation of Stacks.