Why processing an unknown number of parameters, JAVA Programming

Assignment Help:

Why Processing An Unknown Number Of Parameters ?

Most of the time you have a fairly high-quality idea of what parameters will and won't be passed to your applet. Therefore some of the time there will be an undetermined number of parameters. For example Sun's imagemap applet passes each "hot button" as a parameter. Different imagemaps have different numbers of hot buttons. Another applet might need to pass a series of URLs to different sounds to be played in order. Each URL could be passed as a separate parameter.

Or perhaps you need to write an applet in which displays various lines of text. Although it would be possible to cram all this information within one long string, that's not too friendly to authors who need to use your applet on their pages. It's much more sensible to give each line its own PARAM element. If this is the case, you should name the tags thorugh some predictable and numeric scheme. For instance in the text example the by set of PARAM elements would be sensible:

< PARAM name="Line1" value="There once was a man from Japan">
< PARAM name="Line2" value="Whose poetry never would scan">
< PARAM name="Line3" value="When asked reasons why,">
< PARAM name="Line4" value="He replied, with a sigh:">
< PARAM name="Line5" value="I always try to get as many
syllables into the last line as I can.">

The program below displays this limerick. Lines are accumulated within an array of strings called poem. A for loop fills the array along with the various lines of poetry. There are 101 spaces in the array, but since you won't normally required that several, an if clause tests to see whether the attempt to get a parameter was successful through checking to see if the line is null. As soon as one fails, the loop is broken. Once the loop is finished numLines is decremented through one because the last line the loop tried to read was not there.

The paint() method loops through the poem array and prints each String on the screen, incrementing the y position through fifteen pixels each step so you don't draw one line on top of the other.


Related Discussions:- Why processing an unknown number of parameters

Write short notes on (i) rmi and (ii) corba, Question 1 Write a program in...

Question 1 Write a program in Java to find the highest of any five numbers. How do you compile and execute this Java program? Question 2 Write a program to explain the Except

The characteristics of rup? , 1. RUP is relying on a few important principl...

1. RUP is relying on a few important principles and philosophies like planning ahead, knowing where the process is capturing and heading the project in extensible and storable mann

I want to develop a chat application for j2me, I want to develop a Chat app...

I want to develop a Chat application for j2me Project Description: We require a chat application for a community website. Skills required: Java, J2ME

Explain the user defined exceptions, Explain the user defined Exceptions. ...

Explain the user defined Exceptions. User Defined Exceptions are the exceptions which are defined by user for specific purposed. This enables custom exceptions to be generated

Project on image processing, Project Description: Computer vision and Im...

Project Description: Computer vision and Image processing project to extract book title Skills required: Java, C Programming

Upload a file in struts? , In JSP page give the code as given below: en...

In JSP page give the code as given below: enctype="multipart/form-data" name="fileForm" scope="session">     Please select file here that you would like to upload:

Mine craft plug-in coder, Mine craft plug-in Coder Project Description: ...

Mine craft plug-in Coder Project Description: Some custom plugging for my Mine craft server. Skills required: Java, Editing

Write a program that will analyze stocks, Write a program in java that will...

Write a program in java that will analyze stock data and purchase stock with the user''s specific risk and investment. User will select risk from a GUI, high, medium or low and inp

Code for calculatr, how i made a calculator in java plz tell help me

how i made a calculator in java plz tell help me

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd