Moderators: Please dont delete this post as it is featured

A part of an assignment I have due. The assignment states -

A program that prints out lines of asterisks, based on the values determined by the user input. The program first asks for the minimum number of asterisks, the maximum number of asterisks, and the interval. It then prints lines of asterisks, starting with a line with the minimum number of asterisks, and ending with a line with the maximum number of asterisks. The increment of the numbers of asterisks is specified by the interval value. At the end of each line, it should also print how many stars are printed.

Sample Run-

This program prints outlines of stars.
What is the minimum number of stars? 3
What is the maximum number of stars? 15
What is the interval? 4
*** (3 stars)
******* (7 stars)
*********** (11 stars)
*************** (15 stars)

Recommended Answers

All 6 Replies

Thank you.I already have the code in Python.Just need help to convert it to Java.

Please help:

print("This program prints out lines of stars\n\n")
minimum=int(input("What is the minimum number of stars?"))
maximum=int(input("What is the maximum number of stars?"))
interval=int(input("What is the interval?"))
print("\n")
for i in range(minimum,maximum+1,interval):
    for j in range(i):
        print("*",end='')
print(" (%d stars)"%i)

@OP. It appears you are seeking folk to write this for you. Let's look at line 1. Are you revealing that the class hasn't covered how to print a string yet?

PS. Added with edit. If you need to learn how to print a string with Java, why not google that?

I am looking for some valuable suggestions.Seems like I am not getting lucky on that.

Let's focus on line 1. Didn't the class cover how to output text or strings? If it didn't why not google "How to print a string in Java?"

Part of what you learn when programming is how to research. If you disagree, please share why. I'm running into some that only want finished code or they call the discussions "not helping."

If you want finished code, I supplied that as well in 161 languages.

Don't insult people by claiming your problem needs urgent attention. It doesn't, a blocking problem at a customer site that's costing a million dollars an hour until it's fixed is urgent, a school assignment isn't.

You've gotten a lot of help, if you think none of it is valuable, you clearly don't consider anything except a ready made solution to your homework you can then turn in as your own to be valuable.

I'd not want someone who thinks like that as a future colleague.

Learn the language, learn to think, learn to solve problems. That's the most valuable advise anyone can honestly give you here.

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.