1. Find the file ArrayBoundedStack.java which is in package ch02.stacks. Add comments to the file so that it conforms to our specification requirements: ◦ Add @author and @version tags to the file headers ◦ Add method comments and @param tags as needed to each constructor ◦ Move each method comment in front of the method it describes and switch comment symbols to Javadoc style ◦ Add @param, @precondition, and @postcondition tags to each method comment 2. Now you can generate documentation using our javadoc257 command. Generate the docs to the file ~/html/CS257/ArrayBoundedStack so I can find it online. You only need e-mail me when the docs are online so I can go look at them. 3. (EXTRA) Add these methods to your Quadratic class from Homework 3; note that these override the versions inherited from the Object class. Don’t forget to comment the specification for each. equals – returns true if two quadratic equations have the exact same coefficients, false otherwise clone – returns an exact copy of the quadratic equation

1. Introduction

This document presents the necessary modifications to the file `ArrayBoundedStack.java` in the `ch02.stacks` package, following the provided specification requirements. These modifications include adding author and version tags to the file headers, adding method comments and `@param` tags to constructors, moving method comments to the front of the respective methods in Javadoc style, and adding `@param`, `@precondition`, and `@postcondition` tags to each method comment.

2. Modifications to the `ArrayBoundedStack.java` file

2.1 File header modifications

The file `ArrayBoundedStack.java` is missing the required author and version tags. To rectify this, we need to add the following tags:

“`java
/**
* Implementation of an array-based bounded stack.
* @author [AuthorName]
* @version [VersionNumber]
*/
“`

Replace `[AuthorName]` with the name of the author of the file and `[VersionNumber]` with the version of the file.

2.2 Constructor comment modifications

Each constructor in the `ArrayBoundedStack` class requires a comment and `@param` tags to describe its purpose and parameters. For instance, the default constructor can be modified as follows:

“`java
/**
* Creates an empty ArrayBoundedStack with a default capacity of 10.
* @param None
* @precondition None
* @postcondition An empty ArrayBoundedStack is created with a capacity of 10.
*/
public ArrayBoundedStack() {
// Constructor logic
}
“`

2.3 Method comment modifications

Each method in the `ArrayBoundedStack` class needs to have a comment in Javadoc style, a description of its purpose, `@param` tags to describe its parameters, and `@precondition` and `@postcondition` tags to specify pre- and post-conditions. For instance, the `push` method can be modified as follows:

“`java
/**
* Adds an element to the top of the stack.
* @param element The element to be added to the stack.
* @precondition The stack is not full.
* @postcondition The element is added to the top of the stack.
*/
public void push(Object element) {
// Method logic
}
“`

Repeat this modification for each method in the `ArrayBoundedStack` class.

3. Generating documentation using `javadoc257` command

To generate the documentation for the modified `ArrayBoundedStack.java` file, we can use the `javadoc257` command. Assuming the current working directory is where the `ArrayBoundedStack.java` file resides, the following command can be used:

“`
javadoc257 ArrayBoundedStack.java -d ~/html/CS257/ArrayBoundedStack
“`

Replace `~/html/CS257/ArrayBoundedStack` with the desired path where the generated documentation should be saved.

Please notify me via email once the documentation is online, so I can access and review it.

4. Extra Credit: Adding methods to the `Quadratic` class

To add the `equals` and `clone` methods to the `Quadratic` class, we need to override the versions inherited from the `Object` class and provide their respective specifications. The specifications for each method are as follows:

4.1 `equals` method

The `equals` method returns `true` if two quadratic equations have the exact same coefficients and `false` otherwise. The method implementation should consider the following:

“`java
/**
* Returns true if two quadratic equations have the exact same coefficients, false otherwise.
* @param obj The object to compare to.
* @precondition The parameter obj is an instance of the Quadratic class.
* @postcondition True is returned if the coefficients of the two quadratic equations are equal, false otherwise.
* @return True if the coefficients of the two quadratic equations are equal, false otherwise.
*/
@Override
public boolean equals(Object obj) {
// Method logic
}
“`

4.2 `clone` method

The `clone` method returns an exact copy of the quadratic equation. The method implementation should consider the following:

“`java
/**
* Returns an exact copy of the quadratic equation.
* @precondition None
* @postcondition An exact copy of the quadratic equation is returned.
* @return An exact copy of the quadratic equation.
*/
@Override
public Quadratic clone() {
// Method logic
}
“`

These specifications should be added to the `Quadratic` class, along with their respective method implementations.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer