what in the name of god is the code for this question lol
Create a class EchoTest which contains a method echo that takes a string input
parameter and returns the string “You said “ concatenated with the input parameter.
what in the name of god is the code for this question lol
Create a class EchoTest which contains a method echo that takes a string input
parameter and returns the string “You said “ concatenated with the input parameter.
Johnbadboy (17-11-14)
Very impressed with your very intelligent reply here
What programming language are you using ?
Jiberjabber (17-11-14)
You'd really need a language to go on. In Java it would look something like this.
public class EchoTest
{
public echo(String name)
{
System.out.println("You said " + name );
}
public static void main(String []args)
{
for(int i = 0; i < args.length; i++)
{
EchoTest eschotest = new EchoTest( args[i] );
}
}
}
Or you could cheat and use the new Scanner library.
Last edited by Jiberjabber; 17-11-14 at 20:10. Reason: Hmmm ... maybe without the 'for' loop.
thanks lads and jibberjabber appreciate it I know your sick of seeing this stuff all day christ i'm going mental with it seeing syntax errors all day i'm doing a hdip computer course and struggling on these questions i'm doing static methods with some loops in java programming
heres another horrendous question
Create a class NumberFormatter that includes a method with the
following header to format an integer with the specified width.
public static String format(int number, int width)
The method returns a string for the number with one or more prefix 0s. The number
should be greater or equal to 0. The size of the string is the width. For example,
format(34, 4) returns 0034 and format(34, 5) returns 00034. If the number is longer than
the width, the method returns the string representation for the number. For example,
format(34, 1) returns 34.
Write a test program that prompts the user to enter a number and its width and displays
a string returned by invoking format(number, width)
if I could get the echo and this I might scrape a pass I did a boolean and and then a 2 counting up methods but I got them I been looking all day in the intro to prgramming book and online like a spa trying to figure it out lol, whats the new scanner library jibberjabber ??
ive got a feeling this was just a question to flush out all the hackers
"The mass of men live lives of quiet desperation" - Henry David Thoreau.