Java数据结构代写 | CSE 12 PA2 – Generics & ArrayList

本次代写是Java数据结构编程的一个assignment

Useful Resources:

Throughout this assignment, you may find the following resources helpful. Refer to them BEFORE posting
questions on EdStem.

Unix reference sheet
JUnit testing tutorial

Provided Files:

MyList.java
MyArrayListTester.java
MyArrayList.java (empty)

Files to Submit:

MyList.java
MyArrayListTester.java
MyArrayList.java

Goal

In Programming Assignment 2, you will implement a data structure similar to Java’s ArrayList and create
JUnit tests to verify proper operation and implementation. In order to implement MyArrayList, you will
implement the MyList interface and additional methods. You will use existing JUnit tests and also are highly
encouraged to write your own JUnit tests to test your implementation of the MyArrayList.

As you get started, please pay attention to the following:

Please read the ENTIRE write-up before getting started.
For this homework and all homework in CSE 12, you may not change any public class/method or
variable names given in the write-up or starter code.

Getting Started

We strongly recommend that you work on EdStem, but if you choose to work on your own machine, make
sure your code runs correctly on EdStem, as that is where we will be testing it.

Part 1a – Understanding and Testing First

In this programming assignment you will be developing an ArrayList. Of course, these data structures are
already supported in the Java Collections Framework (ArrayList). But as we’ve mentioned in class,
implementing data structures is one of the best ways to become a better programmer and to really
understand what’s going on “under the hood”.

You will be creating a MyArrayList class that implements the given MyList interface. Note, we did not provide
starter code for MyArrayList. Read through the full writeup before you begin. Additionally, we have only
provided you a few tests in MyArrayListTester.java. You will need to test your code by creating your own
tests to ensure that your implemenation functions correctly.

Understand what MyArrayList will do

In order to write a good tester, you will need a deep understanding of how the classes and methods you are
testing are supposed to work. So before you start writing your tester, you should read Part 1b in order to
understand what your ArrayList classes are supposed to do. You may refer to the documentation for
ArrayList.

Test MyArrayList with MyArrayListTester.java

The EdStem starter code will contain MyArrayListTester.java. This is a starter file that defines a small
number of tests against MyArrayList using the JUnit testing framework introduced in PA1. Observe and
check how each test is written and what it tests for.

You are strongly encouraged to add more tests, as the provided starter test is not comprehensive. The
released test cases will be more restricted as you progress through the course, and creating your own
tests is the easiest way to verify and debug your code. You may refer to the Testing section in this
write-up when you write your unit tests.

You should make sure to also include tests to check that your method throws the correct exceptions
when they are expected to throw them. There are more sophisticated ways to do this (feel free to
investigate and use them), but the simple approach is to do the following:

@Test
public void testExceptionMessage() {
try {
new ArrayList<Object>().get(0);
fail(“Expected an IndexOutOfBoundsException to be thrown”);
} catch (IndexOutOfBoundsException anIooBException) {
// You can assume them method passes if expecting an IndexOutOfBoundsException
}
}

Note: It’s sufficient to assume that any IndexOutOfBoundsException is correct, and to simply pass in that
case (i.e. fail if you do NOT enter the catch block, and leave the catch block empty). There is an example of
this in MyArrayListTester.java that you can refer to.

You must not change any method names/ method signatures provided in the starter code.


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论