Wrox Programmer Forums
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2004, 04:19 PM
Registered User
 
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to lucky14
Default I Need Help

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 = ‘+’









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.