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

  Java program to demonstrate the use of jdbc

Write a Java program (non-GUI preferred) to demonstrate the use of JDBC. Write a list of animal and its characteristics to a database using JDBC

  Write a java program to perform matrix multiplication

In this project you need to write a java program called to perform matrix multiplication and

  If the number on two of the players'' four cards

If the number on two of the players' four cards is the same and the number on the remaining two cards is also the same yet the number on all four cards in not the same then the player gets their bet back and in addition wins 22 chips for each chip th..

  A java program that reads the records

A java program that reads the records from the golf.dat file and displays them. It also displays the name of the player with the best (lowest) golf score.

  Use inheritance to read, store, and print questions for test

use inheritance to read, store, and print questions for a test. First, write an abstract class

  Describe the graphical coordinate system in java

Describe the graphical coordinate system in Java. Where is the origin? What units apply to the x,y coordinates

  Write a java program in a netbeans project

Write a Java program in a NetBeans project

  Prompts user to enter 7 elements

Write a java application that prompts user to enter 7 elements. The elements will be stored in an array list of type double.  All elements entered should then be displayed on a separate line. The sum of the elements should also be shown in the end li..

  Implement the lexical and syntactic analysis

Implement the lexical and syntactic analysis of Minifun programming language.

  Create a netbeans java project

Create a NetBeans java project, add the jar file "stdlib-package.jar". The "Picture" class in this package can read and show digital image files.

  Swing gui java application running with eclipse on windows x

To test the program just start MoneyMain to see if you click the icons for the detail screens and click Report to view the two reports.

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