Ask Java Expert


Home >> Java

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

Java, Programming

  • Category:- Java
  • Reference No.:- M91856380

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As