Homework 5 - Methods/Functions: Drawing a box revisited
[Homepage] |
[General Lab Info] |
[TA's & Tutors] |
[FAQ's] |
[Homework] |
[Excellent Programs] |
[Exams]
Due: At Midnight, October 26, 2001, submit is turned off
automatically. Work turned in after that time will not be accepted
for grading.
Program Description
Complete programming exercise 10 at the end of chapter 4 in the text.
For this assignment you are to decompose the drawing of a box into two
functions, drawLine() (for drawing the top and bottom), and drawSides()
for drawing the vertical lines that form the sides. These functions are
to be called from another function, drawBox(). Your main program should
prompt the user to enter the width and height of the box, and the string
to be used to represent the lines of the box. Your main program then
passes these values to the function drawBox().
Here is a sample execution:
os-prompt>java DrawBox
What is the width?
6
What is the height?
5
What string should I use?
testing
testingtestingtestingtestingtestingtesting
testing testing
testing testing
testing testing
testingtestingtestingtestingtestingtesting
os-prompt>
You can read the string using the following:
String pattern = Console.in.readWord();
[Homepage] |
[General Lab Info] |
[TA's & Tutors] |
[FAQ's] |
[Homework] |
[Excellent Programs] |
[Exams]
This page maintained by Charlie McDowell.
Email regarding this site.