Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions This is an individual assignment 1. Read through the code specification in this assignment and Section 1 of Chapter 15 in your Building Java

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Instructions This is an individual assignment 1. Read through the code specification in this assignment and Section 1 of Chapter 15 in your Building Java Programs 4h Ed. (Reges+Stepp) text book to complete this assignment. 2. Generate a Javadoc for the class created. 3. Generate output according to the specifications indicated in this assignment. 4. Upload your work according to the Submitting Work Protocol below. Use eclipse to do the following: 1. create a project folder called Proj IntArrayList on your computer. 2. create a package called version_01. 3. create the class IntArrayList in the version_01 package. 4. create a package called tests. 5. create the JUnit test IntArrayListATest in the tests package. Notes: do not use the wildcard (') feature to import classes or interfaces from the standard library Each class or interface must be stated individually at the top of the class that uses it, i.e. you must import each class or interface separately. o o Topics Exercise Creating an Array List Test of Array List ArrayList IntArrayListTest Int List of Integers JUnit Testing Overview & Specifications A. Concepts Covered B. Objective C. Overview D. Documentation and Style E. Code Implementation F. Coding Incrementally G. Grading Matrix H. Submitting Work A. Concepts Covered o Data Structures o Arrays o Data Storage Objects o Javadoc o JUnit Testing B. Objective To implement a version of a data storage object called an Array List that processes integer values. C. Overview In previous exercises, we examined how to use arrays and classes to store data. The ability to organize and structure data is an important part of solving complex programming problems. Entities that store and manage data are called data structures. These data structures are used to implement more sophisticated data storage objects. For this project, we will take a closer look at one data storage object in particular, the Array List. An array list is an implemented class that uses an array data structure internally to store a group of elements. The group of elements is commonly referred to as a list and can be accessed by integer indexes or by iteration. D. Documentation and Style Your code must follow the Course Style Guide with the standard Java Naming Convention provided (see Canvas for more information). Note: Point deductions will occur if you do not use the format specified in the style guide 1. Write Javadoc comments for each class and public method. 2. Include sufficient internal documentation, such as, class header comments and comments for any private methods or variables used. Use appropriate style (variable names, indenting, class constants, etc.) throughout your coding components (clients, modules, objects etc.). 3. E. Code Implementation 1. Avoid duplicating code wherever possible . Remember that you can call a constructor from another constructor and that repetitive operations can be placed into methods. Decompose methods, if it makes sense to do so. Helper methods should all be private (i.e. should not be a part of the public API). 2. F. Coding Incrementally Figuring out where to begin on this project can be a bit overwhelming. It will make your life a lot easier to get the program working a little bit at a time. Please don't try to write a large chunk of code and then run it. You will cause yourself a lot of time and effort to debug it later. The instructor will turn you away, if you have not demonstrated that you have carefully attempted to incrementally code this assignment before moving on to your next step. G. Grading Matrix The following grades will be administered for the following task achievements. Grade Achievement Level Free of Compile/Runtime Errors Documentation and Style Full implementation of object, no test methods. JUnit Test of Accessors and Mutators. JUnit Test of Constructors and other methods. Generated Output. Max Points 4 6 8 9 10 H. Submitting Work Upload your java class (java), JUnit test (java) and Javadoc (.html) fles to Canvas (individually) Project A - Creating an Integer Array List vity, you will develop a data storage object that contains appropriate data a list of integers and a set of operations for manipulating the list. For this acti occupied vacant tO) (1) (2] (31 (4] (5) (61 (7) [81 191 element size 5 a. Class Specification Below is a UML diagram for the internal view of an IntArrayList object that you will create in this project. Note: Your API will only list the external view (public features). List - element intl int size + DEFAULT_ CAPACITY: int + NOT FOUND int Constructors + IntArrayList() + IntArrayList(capacity: int) Methods + add(value: int) + add(index: int, value: int) + get(index: int): int + indexOf(value : int): int + remove(index: int) + size(): int + toString() String b. Javadoc 1. It is expected that you create a Javadoc for the IntArrayList class, describing what each method does along with its limitations. i. All methods should be listed in alphabetical order i. While the text suggests using precondition and postcondition labels in comments, these labels should be excluded in your Javadoc 2. Method comments should be written from the perspective of the client and not from the implementer's perspective. When you document the class, you will want to describe any important information that should be conveyed a client of the class. 3. Descriptions of any complicated implementations should be placed in the method body c. Code Specification For this project you will develop a version of an ArrayList class called 1. data fields: The fields to declare have private accessibility and are an array i. size keeps track of the number of occupied locations in the internal i. element is a reference variable for the internal array used to hold the 2. constants: The constants are DEFAULT_CAPACITY and NOT_FOUND and IntArrayList which has the following: reference variable named element and a variable named size. array list of integers. have public accessibility and modified to static so that one copy is shared by the objects generated. i. DEFAULT CAPACITY holds the default array length of the internal a ii. array and is used whenever a client does not specify a value for array capacity. NOT FOUND hold the value of-1 to signify an element was not found in list. 3. constructors: The overloaded constructors will initialize the data fields size and element. Create the following constructors: i. The first constructor is a default constructor that calls the second constructor, passing the DEFAULT_CAPACITY in the process. public IntArrayList() The second constructor receives the initial capacity of the internal array and assigns element to an array object with length capacity. public IntArrayList(int capacity) 4. mutators: These are the methods that modify the data fields, size and the internal array referenced by element. i. add: create a method that will append values to the end of the list. public void add(int value) i. add: create a method that will insert values at a given location in the list, shifting subsequent values to the right. public void add (int index, int value) ili. remove: create a method that removes a value at the given index, shifting subsequent values to the left. public void remove (int index) 5. accessors; methods that retrieves the information contained within the data i. get: create a method that returns the value stored at the given index in the array. public int get(int index) size: create a method that returns the size of the occupied locations of i. the array. public int size() ili toString: create a method that displays the contents of the list. public String toString () 6. methods: methods that manages the behavior of the object. indexor: create a method that searches for the location (index) of specific values within the array and returns this location. i. public int indexof (int value) d. JUnit Testing his project excludes tests of the preconditions for methods of the IntArrayList class and how to handle bad values sent to them directly. This will be left for the next project(Project B). 2. Create a JUnit test for each method and constructor in the IntArrayList class. This is where your critical thinking skills will be put to good use. Think about which assertions would show that the methods and constructors work correctly given the current implementation e. Output Crate a test list and Print out the list for each method, demonstrating its contents before and after the method is used. 1. 2. Print out the size of the list for each constructor and accessor call, demonstrating its value after the method or constructor is used

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are the differences between dismissal and discharge?

Answered: 1 week ago