I am supposed to use this method

public static void drawIndentedLine (int spaces, String begin, int n, String middle, String end)

This is what I am suppsed to do
It should print a single line, terminated with a newline, that begins with the specified number of spaces, followed by the begin string, followed by n copies of the middle string, followed by the end string.

Am I doing the right thing for my ouput by using system.out.println ?
"______________"
" ___________"
" _________"

Recommended Answers

All 8 Replies

Am I doing the right thing for my ouput

Does your program print out what you want printed?

yes it should print them but i dont want operation of this method to depend on the main.I am creating 5 other methods like this and i want to use the main only for testing other methods

Can you explain what problems you are having? I don't see how a method would depend on "the main"?
I'm not sure what "the main" is? Is it a method or a class or what?

the main is a the method . I am trying to create 5 other methods with headers which will carry out various operations like drawing indented lines,parralelogram,diamond etc.I am using the main method only to make calls on the other methods to test them.

That sounds normal: the main() method calling other methods to test them.

I just want to know how i can connect methods for example i am planning to draw a diamond using the

public static void drawDiamond (int size)

I want to know how to use drawIndentedLine in my implementation of drawDiamond.I want one loop to draw the top part, and another loop to draw the bottom part. The size of my diamond should be the number of times each loop repeats.

how i can connect methods

By calling them one after the other.

void aMethod() {
  firstMethod(...);
  secondMethod();
  thirdMethod();
}    
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.