// https://piazza.com/class#fall2012/cs46a/911
Part A. Add the following methods to the Bug4
class of
Homework 6C:
public void move(int n)
moves the bug n
times
public int moveToBoundary()
keeps calling move
until the bug hits a boundary, returning
the number of times the bug had to move to get there.
public int moveTo(int x, int y)
keeps calling move
until the bug is at position (x, y),
returning the number of times the bug had to move to get there. If the bug
has moved more than 4 * (maxx + 1) * (maxy + 1)
times, return
-1. (There are only that many distinct (direction, position) combinations
that the bug can assume. If it's not at the desired location by then, it
must be in a cycle.)
Draft: Just implement move
Part B. In the Word
class of Lab 8, add methods
public void replaceEachConsonantWithX()
public void replaceEachConsonantGroupWithX()
public void replaceEachInteriorConsonantGroupWithX()
For example, the word reassuring
will be turned into
XeaXXuXiXX
, XeaXuXiX
, and eaXuXi
.
Draft: Just implement replaceEachConsonant
WithX
Part C. In the Word
class of Lab 8, add methods
public void printLeftTriangle()
public void printRightTriangle()
public void printShifts()
that print patterns such as the following
reassuring g reassuring reassurin ng eassuringr reassuri ing assuringre reassur ring ssuringrea reassu uring suringreas reass suring uringreass reas ssuring ringreassu rea assuring ingreassur re eassuring ngreassuri r reassuring greassurin
Draft: Just implement printLeftTriangle