kayeecheng2102p3s8sa
12.08.2020 •
Computers and Technology
A. Create ArrayIntStack.java (one that's REALLY O(constant), totally!!!)
B. Create the Javadoc web page (separate Assignment #15b).
C. Create your own Stack Class, call it ArrayIntStack.java and write the standard four public Stack methods as listed below (this is the easy part of the assignment). Use at least one private helper method, maybe to ensure capacity of the array. All methods in your ArrayIntStack must have O(constant) run-time. Your ArrayIntStack extends no other Classes from the Java API. You must provide a default constructor.
1. boolean empty(); Tests if this stack is empty (watch spelling here, as I will)
2. int peek(); Looks at the object at the top of this stack without removing it from the stack.
3. int pop(); Removes the object at the top of this stack and returns that object as the value of this function.
4. int push(int item); Pushes an item onto the top of this stack, return what was pushed.
Additional methods, code, etc... will also need to be provided, so the client can use an iterator:
5. public class IntStackIterator { // similar to what the BJP authors show, but without a remove() implemented
6. public IntStackIterator iterator() method so the client can browse through the data with .next() etc... Start the iterator at the top of the stack!!!
You must throw an "appropriate" Exception (e.g. EmptyStackException) for illegal peek, pop, etc... operations. Regarding size, let's say this remains O(constant) while the Stack size is less than 20 elements, beyond that the push(int) would need to throw a Stack Overflow.
Solved
Show answers
More tips
- A Animals and plants Want a Perfect Lawn? Learn How to Plant Grass the Right Way...
- A Animals and plants How to Properly Care for a Pet Decorative Rabbit at Home?...
- C Computers and Internet How to Check the Speed of My Internet?...
- H Health and Medicine 10 Ways to Cleanse Your Colon and Improve Your Health...
- W Work and Career How to Write a Resume That Catches the Employer s Attention?...
- C Computers and Internet Е-head: How it Simplifies Life for Users?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
Answers on questions: Computers and Technology
- M Mathematics What is the simplified form of 72x16/50x36 Assume x ≠ 0...
- E English After reading this excerpt, which claim can Brandon correctly make about the role of law in keeping order? Animals do not kill Man because they are afraid. Animals do...
- E English Select all that apply. Which of the following best describes the main idea of the first paragraph? 1. that which is obtained too easily is not valued as dearly 2. that...
- S Social Studies Explain what this cartoon tells us about special interest money in political campaigns after the Citizens United decision....
- M Mathematics I have 8 red marbles 10 blue marbles and 7 yellow marbles whats the probability that i choose a blue marble put jt back then choose a yellow marble...
- M Mathematics What is the value of the expression k^2 (4b) when k = 12 and b = 4?...
- M Mathematics PLS HELP! im gonna have a mental breakdown again if no one answers my question this time .....
- M Mathematics Which equation is true when the value of x is -8?...
- B Biology both owls and hawks eat mice. explain why the removal of mice from this food web would likely affect owls more than hawks...
- H History The economy of the Arabian Peninsula depended on the ___...
Ответ: