![]() |
Assignment 13TaskPlot a series of user-specified points onto an abstract board.
Concepts: Objects; constants Steps
Write a program that lets the user specify a series of points. Each point has an X and Y position, and a single character that will be used to represent that character on the screen.
Use this class--BoardToken--to store the details of each point together in a single object. (You simply need to save this .java file in the same directory as your
The plotting surface--which you can think of as a whiteboard, a game board, or just an abstract coordinate plane--should be 60 characters wide and 20 characters high. Define constants in your program (using the keyword Therefore, your program needs to first ask for a background character. It should then continue to ask for another character to plot, including its x and y coordinates. Coordinates should start at 1 and are limited to WIDTH and HEIGHT. As always, ensure the user gives you the correct input. Then put a constructed BoardToken object for each point into a single ArrayList. If the user enters nothing when you ask for a character to plot, stop looping. Then, draw the WIDTH x HEIGHT board using the background character, plotting all the points entered by the user as you do so. Sample OutputD:\TA\grading\A13>java ZtomaszeA13 This program plots a series of characters on a 60x20 grid. Enter the board's background character: ' ' Error: input was not a single character. Please try again. Enter the board's background character: Error: input was not a single character. Please try again. Enter the board's background character: * Enter a character to display (or nothing to stop): one Error: input was not a single character. Please try again. Enter a character to display (or nothing to stop): 1 Enter the x position for this character (1 - 60): 0 Error: input was not between 1 and 60. Please try again. Enter the x position for this character (1 - 60): 1 Enter the y position for this character (1 - 20): 1 Enter a character to display (or nothing to stop): 2 Enter the x position for this character (1 - 60): 2 Enter the y position for this character (1 - 20): 2 Enter a character to display (or nothing to stop): 3 Enter the x position for this character (1 - 60): 3 Enter the y position for this character (1 - 20): 3 Enter a character to display (or nothing to stop): 4 Enter the x position for this character (1 - 60): 4\ Error: input was not an integer. Please try again. Enter the x position for this character (1 - 60): 4 Enter the y position for this character (1 - 20): 4 Enter a character to display (or nothing to stop): 1*********************************************************** *2********************************************************** **3********************************************************* ***4******************************************************** ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ D:\TA\grading\A13>java ZtomaszeA13 This program plots a series of characters on a 60x20 grid. Enter the board's background character: Enter a character to display (or nothing to stop): 0 Enter the x position for this character (1 - 60): 25 Enter the y position for this character (1 - 20): 5 Enter a character to display (or nothing to stop): 0 Enter the x position for this character (1 - 60): 35 Enter the y position for this character (1 - 20): 5 Enter a character to display (or nothing to stop): - Enter the x position for this character (1 - 60): 29 Enter the y position for this character (1 - 20): 14 Enter a character to display (or nothing to stop): - Enter the x position for this character (1 - 60): 30 Enter the y position for this character (1 - 20): 14 Enter a character to display (or nothing to stop): - Enter the x position for this character (1 - 60): 31 Enter the y position for this character (1 - 20): 14 Enter a character to display (or nothing to stop): 0 0 --- Discussion
What to Submit
Upload your Grading [8 points]
FAQs
|
~ztomasze Index :
TA Details: ICS111:
A13 http://www2.hawaii.edu/~ztomasze |
Last Edited: 23 Oct 2008 ©2008 by Z. Tomaszewski. |