|
Subject:
|
I Need Help
|
|
Posted By:
|
lucky14
|
Post Date:
|
11/20/2004 3:19:53 PM
|
This is what i need to do, I have no Idea what i am doing. I don't do code i work on the hardware aspect. Please could someone help me
a. Create a class called CharacterArtTools b. Write the following methods:
public void printHorizontalLine(int size, char ch) // It prints a horizontal line consisting size ch characters // For example, if size was 5 and ch was $, then it prints $$$$$ // and follows it by an end of line
public void printVerticalLine(int size, char ch) // It prints a vertical line consisting size ch characters // For example, if size was 2 and ch was $, then it prints // $ // $ // and follows it by an end of line
public void printE(int size, char ch) // Print the letter E of the given size using $ characters { // The algorithm to print E is as follows: // (Picture to the right shows what happens when size = 4, and ch = $ // // 1. print a horizontal line of size characters $$$$ // 2. print a vertical line of size/2 chars $ // $ // 3. print a horizontal line of size characters $$$$ // 4. print a vertical line of size/2 chars $ // $ // 5. print a horizontal line of size characters $$$$ // //
}
c. Create the driver class: CharacterArtDriver d. Write the public static void main(String[] args) method that does the following: Declare an int variable called eSize = 0 and a char variables fillChar = $, userResponse = Y Create a CharacterArtTools object called myCAT Tell the user that this program prints the letter E of a given size made up of characters. while (the userResponse is NOT a N) { o Ask the user to enter a size and read it o Ask the user to enter a fill char and read it o myCAT.printE(size, fillChar); o Ask the user if he/she wants to try another number and read the userresponse (a Y or N) } Print Thanks for using the program message
FOR TESTING IT RUN THE PROGRAM FOR size = 12, ch = $ and size = 10, ch = +
|
|