Question Details

[solution]: e a 700- to 1,050-word paper in which you discuss victimization


Answer download
More Details:

A. Create ArrayIntStack.java (one that's REALLY O(constant), totally!!!)

B. Create the Javadoc web page (separate Assignment #15b).

 

A. 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, to ensure capacity of the array.  All other 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.
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 our author shows for the ArrayIntListIterator, but without a remove()
6. public IntStackIterator iterator() method so the client can browse through the data with .next() etc...

Following the text example, means the iterator will likely traverse from the bottom of the stack, as index 0 is the bottom.

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, past that the push(int) would need to throw an Exception.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

B. Create the Javadoc web page.

Submit just the Javadoc html as a single file that looks good by itself (see below, do not submit index.htm).

 

A. Create your own Stack Class, done for part A.

B. Generate the standard Javadoc for your class (has author, date, and all methods, each with return types plus brief descriptions) and submit just one html file : See Appendix B (Javadoc comments).  Just one html file becomes the tough part of this assignment. Read on......

I require your Javadoc to have method summaries with information as listed (four methods) above, plus the header comments with author and date as shown by example below for the Iterator interface.

Also notice that the private method(s) do not appear in your javadoc.

CAUTION: Be certain your file submitted works by itself!!!  I know it looks fine on your computer, but what will it look like when I get just that one file?

Attached is a sample of the Iterator class Iterator.java from Oracle, which shows how comments are changed to produce the nice html formatted documentation in Java6 the documentation looks like: Iterator.html  similar to what we've been using all along.  This way, the source code itself is used to generate documentation, and version control is handled really nice.

You will probably need to configure your IDE to use the javadoc standard that comes with the Oracle JDK download.  On my computer, the configuration path was (yours' will be slightly different):  C:/Program Files (x86)/Java/jdk1.6.0_21/bin/javadoc.exe   But then I upgraded to Java7 on a 64-bit PC, and the path to javadoc changed to C:/Program Files/Java/jdk1.7.0_25/bin/javadoc.exe  And maybe you've gone as far as Java8 now?

In the Iterator example above I used Java6.  If you never upgraded to Java7, you're lucky, and probably done.  The rest of us have now "updated" to Java7 or Java8 and it gets ugly if you're not careful, see this (BAD->): IteratorJ7.html  We have some more work to do:

You must fix this ugly problem (or suffer loss of points) by either a) providing a ref to a live css page (maybe the oracle.com API pages), and then it gets back to pretty like this (GOOD->): IteratorJ7css.html  or b) putting your stylesheet inside the html,

Option a) Find the stylesheet reference, and change it to something like: rel="stylesheet" type="text/css"href="http://docs.oracle.com/javase/7/docs/api/stylesheet.css"

Option b) Find the stylesheet reference in you html document,   rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"

Comment out or delete that line, and go find the css file in the text/css folder.  Copy that code so you have the following:

<style> body { background-color:#ffffff; color:#353833; font-family:Arial, Helvetica, sans-serif; font-size:76%; margin:0; } ........ etc ........ many many lines of html style code, ending with </style>


And once again: You can only submit one html file here.  Get it right.  And yes, this becomes an HTML exercise, the Java coding is trivial.

((((i wrote the code but i got bad grades and this comment from my instructure please check my code and fix my mistake))))

comment :((((No default constructor???
failed to throw EmptyStackException for pop() when empty
failed to return true from .empty()
failed to return 42 from .push(42)
failed to return 42 from pop() method on [1,-1,999,42]
failed to return 999 from peek() method on [1,-1,999]

OK, but totally missed the style sheet part of the assignment..))))))





import java.util.EmptyStackException;

 

import java.util.Iterator;

 

import java.util.NoSuchElementException;

 


 

import javax.swing.text.AttributeSet;

 

import javax.swing.text.html.HTML.Tag;

 


 


 

/**

 

* &lt;p&gt;

 

* The ArrayIntStack&lt;E&gt; class creates a stack using an array. It has the four common peek, push, pop, and empty.

 

* All the methods have a complexity of O(1).

 

* &lt;br&gt;

 

*

 

* &lt;/p&gt;

 

*

 

* @author

 


 

*

 

*/

 


 

public class ArrayIntStack

 

{

 

private int stackArray;

 


 

private int stackDatas;

 


 

private int top, size;

 


 

public ArrayIntStack(int n)

 

{

 

size = n;

 

stackArray = new int[size];

 

top = -1;

 

}

 


 

/**

 

* Checks if the stack is empty.

 

* @return boolean Returns true, if the stack is empty, otherwise false

 

*/

 


 

public boolean isEmpty()

 

{

 

return top == -1;

 

}

 


 

public void push(int num)

 

{

 

if (top + 1 &gt;= size)

 


 

throw new IndexOutOfBoundsException(&quot;Overfloow Exception&quot;);

 


 

stackArray[++top] = num;

 

}

 


 

/**

 

* Removes an element from the top of the stack and returns it if the stack is not empty.

 

* @throws EmptyStackException Throws an EmptyStackException if the stack is empty

 

* @return int value

 

*/

 

public int peek()

 

{

 

if (isEmpty())

 


 

throw new EmptyStackException();

 


 

return stackDatas[size-1];

 

}

 

/**

 

* Looks at the object at top of this stack without removing it from stack.

 

* @return stackData[size-1]

 

*/

 


 

public int pop()

 

{

 

if (isEmpty())

 


 

throw new NoSuchElementException(&quot;Underfloow Exception&quot;);

 


 

return stackArray[top--];

 

}

 


 

private class IntStackIterator implements Iterator&lt;Integer&gt;

 

{

 


 


 

@Override

 

public boolean hasNext()

 

{

 

return top!=size;

 

}

 


 

@Override

 

public Integer next()

 

{

 

return stackArray[top++];

 

}

 


 

@Override

 

public void remove()

 

{

 

pop();

 


 

}

 

}

 


 

}

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Dec 18, 2020

PRICE: $18.50

Solution~00031148033915.zip (25.37 KB)

Buy this answer for only: $18.50

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Dec 18, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now