(5/5)

We wrestled several years ago with bugs in the coding and probable lack of testing for the DegreeWorks audits for minors, so I decided this might make some interesting homework to focus on black-box testing, white box testing, stubs, and integration.

For Homework 6 and Homework 7, imagine part of your job is to implement and test part of the DegreeWorks audit system for minors. I have implemented and tested the Math minor (see files in D2L). Your job is to extend both the implementation and tests to cover the Media Studies minor and the Stat minor in two phases. The specifications for the minors are from the 2010-2011 catalog (see README.TXT).

For Homework 6, you will implement one additional method to handle another minor along with corresponding white box tests in an additional method in the testing class. You will also implement one additional method stub for the other minor and one additional method in the testing class with black box tests for the stub.

In summary, everyone will have the following methods in AuditMinor.java:

public boolean mathMinor(int[] mathCourses, int[] statCourses)

public boolean statMinor(int[] mathCourses, int[] statCourses)

public boolean mediaStudiesMinor(int[] comsCourses)

and everyone will have the following methods in AuditMinorTest.java

public void testMathMinor()

public void testStatMinor()

public void testMediaStudiesMinor()

For Homework 7, you will replace your statMinor and mediaStudiesMinor with methods I choose and rerun (and adjust if necessary) your tests. You can assume that arrays that are passed to your methods have already been verified in two ways:

No duplicates

Each array entry is a valid RU course number for the indicated department

Also, for simplicity for these homework problems, you may assume that each course is 3 credit hours.

Homework 6 is in 2 parts all of which must be completed by Week 6 Sat 8pm:

Java testing work using JUnit

Homework 6 quiz submission

Here is how I will assess Homework 6:

20 points: Homework 6 submitted on-time with correct two files pasted into question boxes

20 points: AuditMinor methods (3 total - 2 which you write as detailed below)

60 points: AuditMinorTest methods (3 total - 2 which you write as detailed below)

Homework 7 is in 2 parts all of which must be completed by Week 7 Sat 8pm:

Java testing work using JUnit

Homework 7 quiz submission

Here is how I will assess Homework 7:

20 points: Homework 7 submitted on-time with correct two files pasted into question boxes

20 points: AuditMinor methods (3 total - updated as detailed below)

60 points: AuditMinorTest methods (3 total - updated as detailed below)

Homework 6:

Start with the files (AuditMinor.java, AuditMinorTest.java, README.TXT)

Implement statMinor, stub mediaStudiesMinor, white box testStatMinor, and black box testMediaStudiesMinor (students with last names beginning with A-M)

Implement mediaStudiesMinor, stub statMinor, white box testMediaStudiesMinor, and black box testStatMinor (students with last names beginning with N-Z)

Paste your updated AuditMinor.java and AuditMinorTest.java into Homework 6 and submit

I am not asking you to work in teams for Homework 6. I just wanted to split the implementations so I could get several implementations of statMinor and several implementations of mediaStudiesMinor and the corresponding test systems (some written as black box tests and some written as white box tests).

Homework 7:

Replace your statMinor and mediaStudiesMinor with the reference implementations of statMinor and mediaStudiesMinor (see content under Week 7)

Rework your tests as necessary and debug those reference implementations adding comments in both .java files to show which tests caught the two bugs and the changes you made to fix the bugs

Resubmit AuditMinor.java and AuditMinorTest.java in Homework 7

For JUnit work, if you use BlueJ, create a new project Audit and start with the 3 files. One easy way to pull in the two Java files if you are using BlueJ is to use "Add Class from File" to get the two Java files into your project and then copy and paste the specification for the minors from README.TXT into your README.TXT. Also, I wrote the implementation of mathMinor and the corresponding white box tests, so additional black box tests or white box tests for mathMinor which identify possible bugs in my implementation of mathMinor are welcomed.

Read Me

MATHEMATICS MINOR

(18 semester hours)

MATH 151, MATH 152, MATH 251 and MATH 260 and at least two

courses chosen from among MATH 252, MATH 300, MATH 321,

any 400-level mathematics course, or any 300 or 400-level

statistics course.

STATISTICS MINOR

(18 semester hours)

Eighteen semester hours are required in mathematics or

statistics, including at least three semester hours in a

calculus course (MATH 126 or 151). At least 12 of the 18

hours must be in statistics.

MEDIA STUDIES MINOR

The minor in Media Studies consists of 18 semester hours

and includes the following nine semester hours of core

courses: COMS 130, COMS 335 and COMS 400. The remaining

nine semester hours may be chosen from any other COMS

courses offered.

AuditMinor.java

public class AuditMinor

{

public boolean mathMinor(int[] mathCourses, int[] statCourses)

{

boolean minorSatisfied = false;

boolean math151 = false;

boolean math152 = false;

boolean math251 = false;

boolean math260 = false;

int electives = 0;

for (int c = 0; c < mathCourses.length; c++)

{

if (mathCourses[c] == 151)

math151 = true;

else if (mathCourses[c] == 152)

math152 = true;

else if (mathCourses[c] == 251)

math251 = true;

else if (mathCourses[c] == 260)

math260 = true;

else if (mathCourses[c] == 252)

electives++;

else if (mathCourses[c] == 300)

electives++;

else if (mathCourses[c] == 321)

electives++;

else if (mathCourses[c] >= 400)

electives++;

}

for (int c = 0; c < statCourses.length; c++)

{

if (statCourses[c] >= 300)

electives++;

}

if ( math151

&& math152

&& math251

&& math260

&& (electives >= 2) )

minorSatisfied = true;

return minorSatisfied;

}

}

AuditMinorTest.java

import static org.junit.Assert.*;

import org.junit.Test;

public class AuditMinorTest

{

@Test

public void testMathMinor()

{

AuditMinor minor = new AuditMinor();

int[] m0 = { };

int[] m1 = { 151 };

int[] m7 = { 151,152,251,260,252,300,321 };

int[] m6a = { 152,251,260,252,300,321 };

int[] m6b = { 151, 251,260,252,300,321 };

int[] m6c = { 151,152, 260,252,300,321 };

int[] m6d = { 151,152,251, 252,300,321 };

int[] m6e = { 151,152,251,260, 300,321 };

int[] m6f = { 151,152,251,260,252, 321 };

int[] m6g = { 151,152,251,260,252,300 };

int[] m6h = { 151,152,251,260, 403,412 };

int[] m6i = { 138,137,140,142,112,151 };

int[] m4 = { 151,152,251,260 };

int[] s0 = { };

int[] s1 = { 301 };

int[] s2 = { 302,301 };

int[] s5 = { 200,301,302,421,420 };

assertEquals(false, minor.mathMinor(m1, s1));

assertEquals(true, minor.mathMinor(m7, s1));

assertEquals(true, minor.mathMinor(m7, s0));

assertEquals(false, minor.mathMinor(m6a, s1));

assertEquals(false, minor.mathMinor(m6b, s1));

assertEquals(false, minor.mathMinor(m6c, s1));

assertEquals(false, minor.mathMinor(m6d, s1));

assertEquals(true, minor.mathMinor(m6e, s1));

assertEquals(true, minor.mathMinor(m6f, s1));

assertEquals(true, minor.mathMinor(m6g, s1));

assertEquals(true, minor.mathMinor(m6h, s0));

assertEquals(false, minor.mathMinor(m6i, s0));

assertEquals(false, minor.mathMinor(m4, s0));

assertEquals(false, minor.mathMinor(m4, s1));

assertEquals(true, minor.mathMinor(m4, s2));

assertEquals(false, minor.mathMinor(m0, s0));

assertEquals(false, minor.mathMinor(m1, s5));

}

}

(5/5)

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of