Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

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

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

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 ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

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 ...

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 ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

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 ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

  • 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