• 100% Satisfaction Guarantee
Category: Homework
Satisfied Customers: 1757
Experience:  M.S. in Internet Information Systems
59032869
TheDoctor is online now

# One application needs to display stars corresponding to 11

One application needs to display stars corresponding to 11 random numbers and on the left side of the list, there need to be in intervals of 20 (starting at 0) all the way to 200, and on the left it needs to display the stars (which represent the random numbers generated) . The other program needs to store 20 numbers that are random from 0-100 and then print all 20 and calculate the average and the max value. I am really having difficulties implementing the random with arrays (which both of these require).
Hello and thank you for your question. It would be my pleasure to assist you.

Please zip up the code that you have and upload the zip file to http://ge.tt

Once uploaded, you will be given a link on the right. Click on the 'Copy Link' option and then paste that link here.

Thank you
Customer: replied 3 years ago.

http://ge.tt/7vqLP0y/v/0?c

Thank you Ashleigh!

I will review your code and get back to you soon.
Customer: replied 3 years ago.

Thank you! I'm new at programming

Hello again Ashleigh!

The files now do what you have indicated. I also added the average and max to the gradebook one.

Here is how you generate random numbers in java. You use the random class:

Random gen = new Random();

I now have an object instance of the Random class called gen

I can use this object to generate random numbers. You would call:

gen.nextInt(100);

That returns a random number from 0 - 100, non-inclusive. Non-inclusive means that it doesn't include 100. The possible values of the random number are 0 - 99.

If you need 0 - 100, you would use gen.nextInt(101)

On the other hand, if you needed 1 - 100, you would use:

gen.nextInt(100) + 1;

Again, both of your applications are now functioning correctly. Let me know if you have any questions. I'm here to help!

If you require assistance in the future, please feel free to request me directly by starting your question with **For TheDoctor**

Please remember to rate my answer. Thank you so much and have a wonderful day!
Customer: replied 3 years ago.

I just have one problem with the one that prints out stars, it's only supposed to print out 11, but it displays a ton of them

Do you have the actual, word-for-word requirements? because what you just said contradicts what you wrote in your question:

One application needs to display stars corresponding to 11 random numbers and on the left side of the list, there need to be in intervals of 20 (starting at 0) all the way to 200, and on the left it needs to display the stars (which represent the random numbers generated)

There are 11 groups. The stars represent the random number that was generated within that group. I've seen many assignments like this before, but what you wrote as the instructions really doesn't make sense.

Do you have the word-for-word requirements? I will make it work perfectly.
Customer: replied 3 years ago.

I need there to be 11 random numbers, and then stars are used in place of the numbers. For example, let's say the computer generates a random number 132, a star should be placed in the 120-139 category. Everything else is perfect and I really appreciate your explanation of using the random.

I don't thing you are supposed to be generating only 11 random numbers. That part doesn't make any sense. I've seen this assignment before. It is a random number distribution chart. If you only do 11 groups, not random numbers. If you only generate 11 random numbers, there will be entire groups with no stars at all. It just doesn't make sense.

Every time I have worked on this exact assignment, you are to generate any significant number of random numbers. Let's say 200 random numbers. They are then distributed (as you just described)... creating a distribution chart. You can generate 50, 200, 500. The point is that they are distributed on the chart.

If you only do 11 random numbers (which is the number of groups -- I'm certain not the number of random numbers) -- it will not display an accurate distribution chart, as it is far too few.

But I will update so that you can set it to any number of random numbers that you want.
Customer: replied 3 years ago.

I know what you mean! But I want there to be only 11 stars, it's ok if some of the groups are empty, thank you!

Hello again Ashleigh,

The bar chart application now does as you requested.

You can set the number of random numbers that will be generated on line 10. It is the "numbers" variable. It is currently set to 11, as you requested.

You could also change it to 500 and see how it works.

Let me know if you have any other questions.