Details of this Paper

Write a Java program named CreateMouseIsland.java

Description

solution


Question

Program;Write a Java program named CreateMouseIsland.java. The purpose of the program is to create a text file to simulate an island to be used in an experiment. The island is square and surrounded by water. The following characters are used to represent the island;Water is represented by '#;A bridge is represented by 'B;Land is represented by '-;The mouse is represented by 'M;The island has exactly 2 bridges. The mouse position will be somewhere on dry land. Here is an example of an 8X8 island (notice the size includes the water);#####B##;#------#;#---M--#;#------#;B------#;#------#;#------#;########;The island should be stored in a two-dimensional char array.;Your program should prompt the user for the size of the island (including the water). Then prompt the user for the column and row for each bridge, and the column and row for the mouse location.;After the island is created write the Island size and char array to a file named MouseIsland.txt and to the console. The example above would appear as follows;8;#####B##;#------#;#---M--#;#------#;B------#;#------#;#------#;########;Here is an example of running the program;The MouseIsland.txt file would appear as follows;10;#######B##;#--------#;#--------#;#-----M--#;B--------#;#--------#;#--------#;#--------#;#--------#;##########;Make sure you validate the columns and rows for the bridges and mouse. The bridges must be on the island edges and the mouse must be on dry land.

 

Paper#68257 | Written in 18-Jul-2015

Price : $32
SiteLock