Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project: NaturalNumber on String Objectives Familiarity with writing a kernel class for a new type and its kernel operations (NaturalNumber layered on String). Familiarity with

Project: NaturalNumber on String

Objectives

Familiarity with writing a kernel class for a new type and its kernel operations (NaturalNumber layered on String).

Familiarity with developing and using specification-based test plans.

The Problem

The problem is to complete and carefully test implementations of all the constructors and kernel methods defined in interface NaturalNumberKernel, building the data structure representing a NaturalNumberobject by layering it on top of java.lang.String.

Note that implementing and testing a kernel component is significantly different and more challenging than implementing and testing layered implementations (as you have been doing up to this point in this course sequence). For kernel implementations, if just one of the methods in the kernel is wrong then other methods might appear not to work correctly during testing. This makes debugging a challenge. One possible reason is that if your test cases use either equals or toString to check the results, these methods can essentially call any of your kernel methods. Another reason is that if your code for any method fails to make the representation invariant true at the time it returns, then the next method called in the test case might break; but the problem is actually with the previous method. Make sure you understand these difficulties so you can deal with them.

Another danger is that you might unconsciously (or even consciously) choose to use a different representation invariant and/or abstraction function than already stated in the Java class. In this case, you may achieve a result for which no test case can reveal a defect. However, if you don't follow the representation invariant and/or the abstraction function provided, you are liable to a significant deduction of points from your project. This warning applies to this project and all subsequent projects in this course. Recommendation: make sure that each public method makes whatever good use it can of assuming that the representation invariant is true when the method begins. Make sure that each public method and each constructor always makes the representation invariant true. Make sure that each public method meets its contract according to the abstraction function.

Setup

Only one member of the team should follow these steps to set up an Eclipse project for this assignment. The project should then be shared with the rest of the team by using the Subversion version control system as learned in the Version Control With Subversion lab. (http://web.cse.ohio-state.edu/software/2231/web-sw2/extras/instructions/version-control/version-control.html)

For this assignment, instead of creating a new project, you will import a project already set-up for you. First you need to download the project, NaturalNumberOnString.zip, to your computer. Click on this download link (http://web.cse.ohio-state.edu/software/2231/web-sw2/assignments/projects/natural-number-on-string/NaturalNumberOnString.zip) and save the file somewhere on your hard drive where you can easily find it. Make sure that you do not expand this archive. If your browser automatically expands downloaded zip archives, that's OK too. Just pay attention to the special instructions in the following few steps. You may want to make a note of where you saved it.

Import your new project by following these steps:

1. From the File menu select Import....

2. In the new window, expand General and select Existing Projects into Workspace. Click Next.

3. Click on the radio button next to Select archive file and then click the Browse... button. (If the archive was expanded when you downloaded the file to your own computer, click on Select root directory... instead.)

4. In the file selection window, find the NaturalNumberOnString.zip file and select it. (If your browser expanded the archive, find the NaturalNumberOnString directory instead.) Click OK.

5. Click Finish.

Method

1. Complete the body of the private method createNewRep, of the four constructors, and of the kernel methods (multiplyBy10, divideBy10, and isZero) in NaturalNumber3 in the src folder.

2. Complete the body of the four constructorTest methods and of the four constructorRef methods in NaturalNumber3Test in the test folder. You can choose any of the available implementations of NaturalNumber as the reference implementation.

3. Develop a complete and systematic test plan for the NaturalNumberKernel constructors and kernel methods and add your test cases at the end of NaturalNumberTest in the test folder. See the lab where you implemented Queue on Sequence for an example of such a test plan (http://web.cse.ohio-state.edu/software/2231/web-sw2/extras/instructions/version-control/version-control.html), how it is designed, and how each test case is named and structured. A significant portion of your grade for this project will depend on the quality of your test plan.

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

Students also viewed these Databases questions