Create one junit test for dots.java

Assignment Help JAVA Programming
Reference no: EM131102993

I have an assignemt taht needs a good programmer!! its about Java coding.

Assignment 3: Dots Game

Setup

1. Download the assignment.zip and unzip it. This will create a folder user-labsection- assignment3

2. Rename the folder replacing user with the first part of your GMU email address and labsection with your lab section.

? Example: krusselc-206-assignment3 (Katherine Russell, Lab Section 206)
? The folder already contains some code.

3. Complete the readme.txt file (an example file is included: exampleReadmeFile.txt)

Part 1: Dots Game

You are going to write the back end of a game. A GUI has been provided for you as well as a main method that just prints out a single run of the game. This game is a little like pachinko in that balls (which we will call "dots") are dropped from the top of the board and fall down over a series of "pins" that make them go left or right. The board will be represented as a series of characters:

• 'O' (the capital letter o, not zero) will represent the balls ("dots")
• '^' characters will represent pins
• blank spaces will represent "open" areas of the board

Game Code Notes

While the basic game may seem quite simple, you are going to need keep in mind the following things while coding it:

• The game is played in two parts: (1) dropping a dot and (2) using a "step" function to slowly move the dot down the board. There will be separate methods for both these.

• Whenever a dot is dropped, the game will need to keep track of where that dot is on the board and whether or not it has come to a stop. There will be methods for the GUI to use to retreive this information.

• Each call to the "step" function will move the dot down the board one level. If "step" is called and the dot is not able to move, then the game will allow another dot to be dropped.

? This means that when a dot is at the bottom of the board, the "step" method will be called once more before the game "realizes" the dot has come to a stop.

• Four example game boards are provided to you in the "boards" folder. You can open these with any text editor.

• There are get/set position methods which will be used by the GUI to update what the boards look like. Position (0,0) represents the top left of the board.

Existing Code Layout

Two classes have been provided for you. The first is DotsInterface.java which contains the list of methods your Dots class must implement. The second is GameGUI.java which provides the GUI you will see demoed in class. Both of these have been entirely written for you and you do not need to edit them in any way.

Writing Two Custom Exceptions

You will be writing several classes yourself, with certain restrictions on what they must contain. The first class two classes you must write are InvalidBoardException and NoFallingDotException. As a reminder, to write custom exceptions like these, you must make a new class and "extend" some existing exception, i.e. the class declaration will look like:

Class YourNewExceptionName extends SomeOtherException

You do not need to put any code in these classes, just empty braces will do (see Assignment 2 GameFileNotFoundException.java). Both these classes should "extend" Exception (not RuntimeException or any other exception class).

Writing The Dots Game

This class will "implement" the DotsInterface (which means it promises to have all the methods whose signatures can be found in the DotsInterface which has been provided to you). The class declaration should look like:

Class Dots implements DotsInterface

The methods in DotsInterface have been commented fully with JavaDoc style comments. Those comments describe in detail what is expected of that method. The following may be helpful in understanding how these comments work:

Typical method comment:

/**
* A general text comment describing the method and what it does. Below
* this comment are "annotations" which give details on the method's
* parameters, what the method returns, and any exceptions it might throw.
*
* @param parameter1Name a description of the first parameter and what it is used for
* @param parameter2Name a description of the second parameter and what it is used for
* @return a description of what the method returns
* @throws ExceptionName a description of when the exception might be thrown
*/

Part 2: Unit Tests

Some test cases have been provided for you, but none of these test a full game. So:

1. In MyUnitTests.java, create one JUnit test for Dots.java. This test MUST:

• test a full game, from dropping the first dot to being unable to drop any more dots because the board is full
• test a board of size 3x3 or larger
• test a board with at least one pin

2. Run your unit tests against your implementation and see if your code passes.

3. Correct either your code or your unit test until you've got it working.

The example tests given to you have lots of examples of testing what a board looks like and how to tell if a dot has moved into the correct position.

Attachment:- assignment.zip

Reference no: EM131102993

Questions Cloud

What was the initial size of the culture : The count in a bacteria culture was 600 after 10 minutes and 2000 after 40 minutes. Assuming the count grows exponentially,
Planners lab presentation on walmart or target : Download and learn how to use the Planners' Lab. You will be using this tool for this project. Go to your Yahoo Finance and choose any of the publicly traded companies, for example, Walmart or Target. Using their financials, and applying the Plann..
When the company sells a new issue of stock : Is it true that the "flatter," or more nearly horizontal, the demand curve for a particular firm's stock, and the less important investors regard the signaling effect of the offering, the more important the role of investment bankers when the company..
Determine how long the match goes on : Determine how long the match goes on (it might be just N bytes long, or it might extend past the first N matching bytes to be many bytes longer).
Create one junit test for dots.java : Some test cases have been provided for you, but none of these test a full game. So: In MyUnitTests.java, create one JUnit test for Dots.java. This test MUST test a full game, from dropping the first dot to being unable to drop any more dots because t..
An original business research project : The final version of your Research Project should be 10 to 12 double-spaced pages (not including the title page, reference page, tables, appendices, etc.).
Discuss the roles played by financial ratios in general : Select a local hospital and compare its financial ratios for the most recent three years against the national norms for this type of institution. Include analytical comments and how the organization compares to the national norms as well as any su..
Different movie soundtracks : Jenny White is shopping for CDs. She decides to purchase 3 movie soundtracks. The music store has 10 different movie soundtracks in stock. How many different selections of movie soundtracks are possible?
Determine the peak frequency deviation in hertz : Determine the peak frequency deviation in hertz.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Prompt the user for a series of numbers

Prompt the user for a series of numbers that may be either a binary number or a decimal number.

  Write down ijvm code to remove top two words from stack

Write down IJVM code which will remove these top two words, multiply and put their product back on stack. You are allowed to use existing IJVM instructions only.

  Purchasing type of mobile device

Mobile devices use touch screens to interact with the individual. Select a mobile device and identify three (3) important usability features that are important to you when purchasing this type of mobile device. Provide a rationale for your respons..

  Basiclinkedtree and bstree classes

This generic class is used in the BasicLinkedTree and BSTree classes.  The class consists of a reference to the data and a reference to the left and right child.Follow the Javadoc that is provided.  The Javadoc only lists those public methods that..

  Interface named comparison

Create an interface named Comparison whose method can be used to compare two Time object. The Method will include isGreater,isLess,and is Equal.

  Allows the user to specify a triangle with three mouse press

Write a program that allows the user to specify a triangle with three mouse presses. After the first mouse press, draw a small dot. After the second mouse press, draw a line joining the first two points. After the third mouse press, draw the entir..

  Reads in up to 1000 non-negative integers

Write a program that reads in up to 1000 non-negative integers and displays distinct numbers (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read each number and store it in an array if it is new. If the number is alread..

  Create a book class which stores the information

You run a small library. Ask the user to provide information for several books. The information must include the author, title and publisher of each book.

  Programming languages for example pascal

Some programming languages for example Pascal have used the semi colon to seperate statements while java uses it to terminate the statements. which of them in your opinion is most natural and least likely to result in syntax errors? support your a..

  Finalize() method invoked by the garbage collector

Under what conditions is an object's finalize() method invoked by the garbage collector?

  Design a payroll class with the fields

Write a constructor that initializes these fields as well as accessor and mutator methods - Demonstrate the class in a program that contains a Car object, and then calls the accelerate method five times.

  Implement a simple relational dbms

In Problem Set, you began to implement a simple relational DBMS by taking the code base that we gave you and adding support for INSERT commands and for SELECT * commands involving a single table.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd