Question about assingment.
Here is my assignment.
Write a Java program that prompts the user to enter five values of type double and displays their average as an integer. Use CASTING and NO points for this if you use five different variables.
I really don't know how she wants me to use one variable. Could some one better explain this problem.
Thanks Again!
Re: Question about assingment.
spoon-feeding answer deleted. Let's help folks learn Java, but let's not simply do their work for them.
--- Update ---
To Rain_Maker: Declare a double variable, sum, before your for loop, and inside the loop, use a Scanner to get a value that is immediately added to sum.
Re: Question about assingment.
Ohhhhh I see what you mean!!! I figured I was going to use some type of loop but I didn't know how I was going to use it. So basically I'm going to ask the user 5 times for a value of double. Each time the loop is asked the value will be added. From there I will have my final value. If I'm understanding this right.
Re: Question about assingment.
Quote:
Originally Posted by
Rain_Maker
Ohhhhh I see what you mean!!! I figured I was going to use some type of loop but I didn't know how I was going to use it. So basically I'm going to ask the user 5 times for a value of double. Each time the loop is asked the value will be added. From there I will have my final value. If I'm understanding this right.
It sounds like you're on the right track, but to be sure, code it up and see what happens. To get the best experience from this class, I suggest that you code up any ideas you have, and that you play with and adjust your code frequently to see what happens. Think of the Java compiler as a grand science lab that you get to play in to your heart's content.
Re: Question about assingment.
Quote:
Originally Posted by
curmudgeon
spoon-feeding answer deleted. Let's help folks learn Java, but let's not simply do their work for them.
--- Update ---
To Rain_Maker: Declare a double variable, sum, before your for loop, and inside the loop, use a Scanner to get a value that is immediately added to sum.
Oops sorry, it's my first time here. :3
Re: Question about assingment.
Hey curmudgeon never got to thank you. But I resolved the issue.
Thanks Again!
Re: Question about assingment.