Question: *Java* I need help understanding an assignment to do with Asciiart. I am supposed to write it in java. If someone could help me that'll

*Java* I need help understanding an assignment to do with Asciiart. I am supposed to write it in java. If someone could help me that'll be awesome! Thank you so much. also if it isn't too much of an hassle can you do comment lines so I see the general idea of whats going on. Thanks so much!

You will write a class AsciiArt that has the following attributes:

private char [][] image;

private int nrRow;

private int nrCol;

And the following methods:

public AsciiArt(String filename, int nrRow, int nrCol) - a constructor that reads an ascii image from a file.

public void floodFill(int row, int col, char target, char replacement) - This will implement an iterative version of the flood fill algorithm using a Queue:

Flood-fill (node, target-character, replacement-character): 1. If target-character is equal to replacement-character, return. 2. Create an empty queue Q. 3. Add node to the end of Q. 4. While Q is not empty: 5. Remove first element from Q and store it in a variable n. 6. If the character at the position specified by n is equal to target-character: 7. Set the character to replacement-character. 8. Add west node to end of Q if west has not been processed yet. 9. Add east node to end of Q if east has not been processed yet. 10. Add north node to end of Q if north has not been processed yet. 11. Add south node to end of Q if south has not been processed yet. 12. Return.

public void replaceCharColor(char target, char replacement) - this method will replace all occurrencethis of the target character with the replacement character regardless of whether the areas are connected or not.

public String toString() - creates a string representation of the image.

public void replaceArea(int row1, int col1, int row2, int col2, char replacement) - replaces all characters in the given region with the specified replacement character.

public void save(String filename) - saves the image in the specified file.

You will also write another class AsciiArtEditor where you will have a main method. Ask the user for a filename and number of rows and number of columns. Create an object of the class AsciiArt. Display a menu to the user with five choices:

Apply Flood Fill

Replace color

Replace area of the image

Display Information

Save

Exit

For 1, Ask the user to enter the row and column and a desired replacement character. Execute the floodFill algorithm. Display the edited image.

For 2, ask the user for a target character and the replacement character

For 3, ask the user for the rows and columns of the region and the replacement character.

For 4, display the dimensions of the image.

For 5, ask the user for a filename and save the image in that file.

6 exits the editor.

****Input*** Scream.Txt

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXP XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY?""" . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY?"" ,;ciCCC "?YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYYY??"" .,;iCCCCCCCCCC .,. `""""""???YYYYYYYYYYXXXXXXXYYYYY???""""""" ..,;ciiCCCCCCCCCCC''` ```'`CCiiicccccccccc;;,,. .,..,..,;cccciiiCCCCCCC????>''````` .;ciCCC Cic;,. `''<'` ``''?CCCCCCCCCC"'```''CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC??""''`` _.,;cciCC ic;;,. ````'JP" .,;;,.!!;,.!!!!!!! $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$C3$$ -' --''`!!!!'`' .. `! $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Ci??c,,,.,..,. ````` $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$JJCCCC????????$$????rrrcccc, $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$C<<$$$$$PF<$$$$ $$$$$cizccCCCCCCCCCcccc$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$?????)>>J$CLccc$??"" $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$????ii?iiJJJ$$??""" $$$$$$$$$$$$$??$$$$????P$$$???iiiiicccccc<>J>>>>cccccc>>>??C????CC>cccJ$??""""" -``!!;!' .!!!' $$$$$??CCCCCCCCCCCff>>>>>J$$$P"""""""" ..,;;;;;;;!'`.,;;!''' ??????????????"""""'' `' .,..,;;;;!!!'```..```' .,.,;;;- `,;' .,. ,;;----'''''''```````' `''`,;;!!'''`..,;;'' ,; ---;;;;;;;-----'''''''''``' --- `' .,,ccc$$hcccccc,. `' ,;;!!!'``,;;!!' ;;;;,,.,;-------''''''' ,;;!!- .zJ$$$$$$$$$$$$$$$$$$$c,. `' ,;;!!!!' ,; ```' -;;;!'''''- `.,.. .zJ$$$$$$$$$$$$$$$$$$$$$$$$$$c, `!!'' ,;!!' !!- ' `,;;;;;;;;;;'''''```' ,c$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$c, ;!!'' ,; ,;;;!!!!!!!!''``.,;;;;!'`' z$$$$$$$$???"""""'.,,.`"?$$$$$$$$$$$ ``,;;!!! ;;.. --''```_..,;;! J$$$$$$??,zcd$$$$$$$$$$$$$$$$$$$$$$$$h ``'``' ```''' ,;;''``.,.,;;, ,$$$$$$F,z$$$$$$$$$$$$$$$$$$$c,`""?$$$$$h !!!!;;;;, --`!''''''' $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$h.`"$$$$h . `'''``.,;;;!;;;--;; zF,$$$$$$$$$$?????$$$$$$$$$$$$$?????$$r ;?$$$ $. !;.,..,.````.,;;;; ,$P'J"$$$$$$P" .,c,,.J$$$$$$$$$"',cc,_`?h.`$$$$ $L '``````' .,.. ,$$". $ $$$$P",c$$$$$$$$$$$$$$$$',$$$$$$$$$$ $$$$ $$c, !!!!!!!!!!!!!''' J$',$ $.`$$P c$$$$$$$$$$$$$$$$$$,$$$$$$$$$$$ $$$$ $$$$C `` J$ ,$P $$ ?$',$$$$???$$$$$$$$$$$$$$$??"""?$$$ <$$$ $$$$$ c ;, z$F,$$ `$$ $ ?$" "$$$.?$$$ $$$P c??c, ?$.<$$',$$$$$F $$h. -!> (' $" $F ,F ?$ $ F ,="?$$c,`$$F $$"z$$',$' ,$$P $h.`$ ?$$$$$r $$$$$hc,. ``' J$ $P J$ . $$F L ",,J$$$F <$hc$$ "$L,`??????,J$$$.` z$$$$$ $$$$$$$$$$c,'' ?F,$',$F.: $$ c$c,,,,,c,,J$$$$$$$ ?$$$c,,,c$$$$$$F. $$$$$$ `"$$$$$$$$$$$c, $$',$$ :: $$$$$$$$F"',$$$$$$$$$$h ?$$$L;;$$$??$$$$ $$$$$$ "?$$$$$$$$$$ $$$$$$ : .`F"$$$$$$$$$$$$""""?"""h $$$$$$$"$,J$$$$ $$$$$' "?$$$$$$$ $$$$$$.`.` h `$$$$$$$$$$$cccc$$c,zJ$$$$$P' $$$$$P',$$$$P $. `""?$$ $$$$$$$ ` "$c "?$$$$$$$$$$$$??$$$$$$$$" ,J$$$P",J$$$$P .. `" ?$$$$$$h ?$$c.`?$$$$$$$$$' . <$$$$$' ,$$$" ,$$$$$" !!>. . `$$$$$$$h . "$$$c,"$$$$$$$' `' `$$$P ,$$$' ,c$$$$$' ;! ``` `$$$$$$$c "$$$c`?$$$$$ : : $$$ ,$$P' z$$$$$$' ;!! $hc ```' ; `$$$$$$$. ?$$c ?$$$$ .: : $$$ $$F ,J$$$$$$' ;!! .,.. ' `$$$$$$$ "$$h`$$$$ .' ' $$$ ,$$ ,J$$$$$$' !!! ????P `$$$$$$L $$$ $$$F :.: J$$P J$F J$$$$$P ;!! -=< ?$$."$$ `$$ ?$$' `' z$$$F $P $$$$$$' !!' cc `$$$c`? ?$.`$$hc, cd$$F ,$' $$$$$$ ;!! $$$$c `$$c$$$$$$$$$",c$' $$$$$$ `!! $$$$$ `?$$$$$$$$$$$$P' $$$$$$> .. $$$$$ `"?$$$$$$$P" $$$$$$L $$c, !! <$$$$$ zc,`"""', <$$$$$$.`$$$$cc, !! J$$$$P `$$$$$$$' !' $$$$$$L `$$$$$$h ;, $$$$$L `! J$$$$$',!! $$$$$$$ `$$$$$$ ' <$$$$$. ! $$$$$$ !! ?$$$$$$ `$$$$$ ,$$$$$$$c `,`???? ;' c,?$$$$' `?$$$ $$$$$$$?? `!;;;;! . `h."?$P `$$$ ,$$$$$$$h. `''' `' `$$$P `?$ $$$$$$$$h `!' `"' ` `$$$$$$$$F !; ! ;, `$$$$$$$' `!!> `! c, ;, `?$$$$P !!> . $F !!> `""' `!! ;!> <- $F `!!' ;!; ' `!  ; $F `'  !! ?' `' !!! !!! !!> !! !!'  ;!!! `! `'' ;!!! ! `! ;! ;!!! ,$$c, ` !'' ;!!! ' ,c$$$$$$c. > ; !!! ?$$$$$$$$$ !!> ;!! .!!! .!> "?$$$$$$$  ` .!!!  !!!  `! !!' !!!' `!!';!> !! . ' ; .;!!!' !!! `!! ;!!''! J$$c `!!; !!> ;!!! ;!!  !! `!! !' J$$$$hr `'' !!!,;; ;!!! !!  $$$$$$$$$$. `' ! `!!! !!!!!' !!! !! `!!! ?$$$$$$$??$c !!>; ;!! ;!!!!! ;!!> !!  ?$$$$$$c,`$$. `!!! !!! !!! !' `!!> !! !!! "?$$$$$$ "?$c ` ! ;!!!, "$$$$$$c,"?$c, ;!! !! ;! !!!! ! `!!!! "$$$$$$c ?$$h. !!!> !! !! !!!! !!! "?$$$$c "$$$c, !!!' ' !! `!!! `! "$$$$h.`?$$$c,   ?$$$$$c ?$$$$h. `!!! `!! !!! `' "?$$$$h.`?$$$$ `!!> !! `!! `?$$$$$$$$$$ `!' !! `' "$$$$$$$$$ `!> ?$$$$$$$ `! `"?$$$$ `- ;! `"$$ `? 

***Output When changing X with A***

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY?""" .

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY?"" ,;ciCCC

"?YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYY??"" .,;iCCCCCCCCCC

.,. `""""""???YYYYYYYYYYAAAAAAAYYYYY???""""""" ..,;ciiCCCCCCCCCCC''`

```'`CCiiicccccccccc;;,,. .,..,..,;cccciiiCCCCCCC????>''````` .;ciCCC

Cic;,. `''<

CCCCCCCCCCCCcc;;;,,. .,..,..,..,;;cciiiiCCCCCCCCCCCCCCCCCCCCC??>'`

``''?CCCCCCCCCC"'```''CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC??""''`` _.,;cciCC

ic;;,. ````'

CCCCCCCCCiic;._ ```''"

. ```'''`CCCCCCCiicc;,,,,,.. ```````' .,,,AiiAAAAAAAAAA

AAAAAAAA,,,. ``````````````````` .,..,..,.AiAiiAiiAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY??"""

"""?YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYY???"""

= """""???YYAAAAAAAAAAAAAAAAAAAAAAAAAAYYY???"" ,;

-;ccccc;;,.,.. """""""""" ,;ciCC'``'

;;, ```'???CCCCC `''--;CCicc;;, .,;;,,,. .. .,;ciCCCCCCCicc;-

C'```CCiiiiiCCCCtCiicc;,. ```' . .,;;iCCCCC'' .,;;cccc-''`CCCCCCCCCCCCC;;

CCCCc;,,.,;CCCcc,,,,..'' .;CC'`'CCCCCCCCCC'' ``' .,;;;cc===`CC''````````'

.,...```' .C.,.`""""?CCCCC'`CCC''''``' .,.,;ciCCCCCC..,;cciiCtttCCCCCCCtt

```' `'`CCCCCCCCCCC' . `' ```' .,. ```CCC''''`CCCCCCCCCCCCC?"''

.. ``' ```'

$$$$$$$$$$$$ccc$$$$$$$$"?hccc=Jcc$$hccccccc$$$$$$$$$$$$$cccccc,,,,,ccc,,..

$$$??hcccci???CCCCCC$$L ,$$$$c $$hcccccJ???LcccccccccJCCC???????CCCC??????

$$F `?$$$$$$$$$$$$$$$$. ,$$"$$.?$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$$,. ,$$$$$$$$$$$$$$$$. ,$$ $$h $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$??????????$$

$$$h $$$$$$$$$$$$$$$$$$ $$$ ?$h ?$$$$$$$$$$$$$$$$$$$$$$$???izc?????????i??

???" ?????$$$$$$$"""""" "" ?"" `"?"""$$$$$$$$??

,,,,,,,,,J$$$$$$$$,.,,,,,,,,.. ,$$$$$$P>JP" .,;;,.!!;,.!!!!!!!

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$C3$$ -' --''`!!!!'`' .. `!

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Ci??c,,,.,..,. `````

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$JJCCCC????????$$????rrrcccc,

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$C<<$$$$$PF<$$$$

$$$$$cizccCCCCCCCCCcccc$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$?????)>>J$CLccc$??""

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$????ii?iiJJJ$$??"""

$$$$$$$$$$$$$??$$$$????P$$$???iiiiicccccc<

$$$$$CCCCCCC>>J>>>>cccccc>>>??C????CC>cccJ$??""""" -``!!;!' .!!!'

$$$$$??CCCCCCCCCCCff>>>>>J$$$P"""""""" ..,;;;;;;;!'`.,;;!'''

??????????????"""""'' `' .,..,;;;;!!!'```..```' .,.,;;;- `,;'

.,. ,;;----'''''''```````' `''`,;;!!'''`..,;;'' ,;

---;;;;;;;-----'''''''''``' --- `' .,,ccc$$hcccccc,. `' ,;;!!!'``,;;!!'

;;;;,,.,;-------''''''' ,;;!!- .zJ$$$$$$$$$$$$$$$$$$$c,. `' ,;;!!!!' ,;

```' -;;;!'''''- `.,.. .zJ$$$$$$$$$$$$$$$$$$$$$$$$$$c, `!!'' ,;!!'

!!- ' `,;;;;;;;;;;'''''```' ,c$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$c, ;!!'' ,;

,;;;!!!!!!!!''``.,;;;;!'`' z$$$$$$$$???"""""'.,,.`"?$$$$$$$$$$$ ``,;;!!!

;;.. --''```_..,;;! J$$$$$$??,zcd$$$$$$$$$$$$$$$$$$$$$$$$h ``'``'

```''' ,;;''``.,.,;;, ,$$$$$$F,z$$$$$$$$$$$$$$$$$$$c,`""?$$$$$h

!!!!;;;;, --`!''''''' $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$h.`"$$$$h .

`'''``.,;;;!;;;--;; zF,$$$$$$$$$$?????$$$$$$$$$$$$$?????$$r ;?$$$ $.

!;.,..,.````.,;;;; ,$P'J"$$$$$$P" .,c,,.J$$$$$$$$$"',cc,_`?h.`$$$$ $L

'``````' .,.. ,$$". $ $$$$P",c$$$$$$$$$$$$$$$$',$$$$$$$$$$ $$$$ $$c,

!!!!!!!!!!!!!''' J$',$ $.`$$P c$$$$$$$$$$$$$$$$$$,$$$$$$$$$$$ $$$$ $$$$C

`` J$ ,$P $$ ?$',$$$$???$$$$$$$$$$$$$$$??"""?$$$ <$$$ $$$$$

c ;, z$F,$$ `$$ $ ?$" "$$$.?$$$ $$$P c??c, ?$.<$$',$$$$$F

$$h. -!> (' $" $F ,F ?$ $ F ,="?$$c,`$$F $$"z$$',$' ,$$P $h.`$ ?$$$$$r

$$$$$hc,. ``' J$ $P J$ . $$F L ",,J$$$F <$hc$$ "$L,`??????,J$$$.` z$$$$$

$$$$$$$$$$c,'' ?F,$',$F.: $$ c$c,,,,,c,,J$$$$$$$ ?$$$c,,,c$$$$$$F. $$$$$$

`"$$$$$$$$$$$c, $$',$$ :: $$$$$$$$F"',$$$$$$$$$$h ?$$$L;;$$$??$$$$ $$$$$$

"?$$$$$$$$$$ $$$$$$ : .`F"$$$$$$$$$$$$""""?"""h $$$$$$$"$,J$$$$ $$$$$'

"?$$$$$$$ $$$$$$.`.` h `$$$$$$$$$$$cccc$$c,zJ$$$$$P' $$$$$P',$$$$P

$. `""?$$ $$$$$$$ ` "$c "?$$$$$$$$$$$$??$$$$$$$$" ,J$$$P",J$$$$P

.. `" ?$$$$$$h ?$$c.`?$$$$$$$$$' . <$$$$$' ,$$$" ,$$$$$"

!!>. . `$$$$$$$h . "$$$c,"$$$$$$$' `' `$$$P ,$$$' ,c$$$$$' ;!

``` `$$$$$$$c "$$$c`?$$$$$ : : $$$ ,$$P' z$$$$$$' ;!!

$hc ```' ; `$$$$$$$. ?$$c ?$$$$ .: : $$$ $$F ,J$$$$$$' ;!!

.,.. ' `$$$$$$$ "$$h`$$$$ .' ' $$$ ,$$ ,J$$$$$$' !!!

????P `$$$$$$L $$$ $$$F :.: J$$P J$F J$$$$$P ;!!

-=< ?$$."$$ `$$ ?$$' `' z$$$F $P $$$$$$' !!'

cc `$$$c`? ?$.`$$hc, cd$$F ,$' $$$$$$ ;!!

$$$$c `$$c$$$$$$$$$",c$' $$$$$$ `!!

$$$$$ `?$$$$$$$$$$$$P' $$$$$$> ..

$$$$$ `"?$$$$$$$P" $$$$$$L $$c,

!! <$$$$$ zc,`"""', <$$$$$$.`$$$$cc,

!! J$$$$P `$$$$$$$' !' $$$$$$L `$$$$$$h

;, $$$$$L `! J$$$$$',!! $$$$$$$ `$$$$$$

' <$$$$$. ! $$$$$$ !! ?$$$$$$ `$$$$$

,$$$$$$$c `,`???? ;' c,?$$$$' `?$$$

$$$$$$$?? `!;;;;! . `h."?$P `$$$

,$$$$$$$h. `''' `' `$$$P `?$

$$$$$$$$h `!' `"' `

`$$$$$$$$F !; ! ;,

`$$$$$$$' `!!> `!

c, ;, `?$$$$P !!> .

$F !!> `""' `!! ;!> <-

$F `!!' ;!; ' `! ;

$F `' !!

?' `' !!! !!! !!> !!

!!'

;!! !! !!!! !'

!!! `' !!! ' ;

!! ;!!' !

!!! ;! !

,;;> ;!!! `!

`'' ;!!! ! `!

;! ;!!! ,$$c, `

!'' ;!!! ' ,c$$$$$$c.

> ; !!! ?$$$$$$$$$

!!> ;!! .!!! .!> "?$$$$$$$

. ' ' ;!!! .!!!! !! . `"?$

`' `

.!!!

!!!

`!

!!' !!!' `!!';!> !! .

' ;

.;!!!' !!! `!!

;!!''! J$$c `!!; !!>

;!!! ;!! !! `!! !' J$$$$hr `'' !!!,;;

;!!! !!

!!! !; $$$$$$$$$$. `' !

`!!! !!!!!' !!! !! `!!! ?$$$$$$$??$c !!>;

;!! ;!!!!! ;!!> !! ?$$$$$$c,`$$. `!!!

!!! !!! !' `!!> !! !!! "?$$$$$$ "?$c `

;!! !! ;! !!!> ! ;!!!, "$$$$$$c,"?$c,

;!! !! ;! !!!! ! `!!!! "$$$$$$c ?$$h.

!!!> !! !! !!!! !!! "?$$$$c "$$$c,

!!!' ' !! `!!! `! "$$$$h.`?$$$c,

?$$$$$c ?$$$$h.

`!!! `!! !!! `' "?$$$$h.`?$$$$

`!!> !! `!! `?$$$$$$$$$$

`!' !! `' "$$$$$$$$$

`!> ?$$$$$$$

`! `"?$$$$

`- ;! `"$$

`?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!