Quote:
Is it possible to do it using array?
Yes.
In fact, I'd look at using an array to hold your data, and methods do do "similar code".
If you look at your code, there are "chunks" which repeat, differing only by the variables they use. For example:
System.out.print("\nArt ");
for (int num = 0; num < art; num += 1)
{
System.out.print("*");
}
System.out.print("\nBob ");
for (int num = 0; num < bob; num += 1)
{
System.out.print("*");
}
Put that code in a method, and pass it the variables so the code only exists once, and you code starts to get more concise without using an array at all. This also has the advantage that changes to the method only have to be made once - so your code becomes more reliable.
I'd start by identifying "duplicate" code, and converting it to methods, then think about using an array once I'd got that working, as it is a little more complex to to (and doing things one at a time - making sure it still works before moving on - is a good way to develop code).