Results 1 to 20 of 20
- 07-28-2011, 04:28 AM #1
Inputting arrays to find the average
Trying to learn how to do arrays but our teacher is away and theres no way any of us can figure this out. I have a pseudocode of how it should be written and thats all.
Any help would be appreciated.Java Code:Pseudocode TeamHeight Set totalHeight to zero Set arrayElements to 11 DOWHILE index = 0 to arrayElements Prompt user for height Get height(index) totalHeight = totalHeight + height(index) display height(index) ENDDO Compute averageHeight = totalHeight/arrayElements Display averageHeight END
- 07-28-2011, 04:40 AM #2
Instead of posting your pseudocode, try writing the code, compiling it and running it. If it doesn't work then post your code, include all error messages (full and exact, no paraphrasing) and ask a specific question.
- 07-28-2011, 04:41 AM #3
We don't know how to write it because we are ****** retarded and our teacher is away.
Last edited by Fubarable; 07-28-2011 at 04:44 AM. Reason: obscenity removed
-
- 07-28-2011, 04:51 AM #5
Really.
You don't even know how to write a class? Or a loop? Or a print statement? Or any other legal Java syntax. You might not know how to write the complete program but you should know how to do individual snippets. If you do then try building it up a small piece at a time. If you don't then go back and read your course material. I'm sure your teacher would not set an assignment for material that has not been covered.
Also, do you really think that people will be encouraged to help you if you swear at them.
- 07-28-2011, 07:39 AM #6
can someone please just tell HOW THE **** to make an array which stores users input
Last edited by DarrylBurke; 07-28-2011 at 08:39 AM. Reason: Obscenity removed
- 07-28-2011, 07:41 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Last edited by DarrylBurke; 07-28-2011 at 08:39 AM. Reason: Obscenity removed
- 07-28-2011, 07:46 AM #8
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
If you want the answers try rent a coder, at this site we will help if you try.
- 07-28-2011, 07:48 AM #9
Instead of wasting time telling me to do something why can't you just help.
- 07-28-2011, 07:51 AM #10
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Because we are here to help, not do your homework. If you are not interested in learning the material you should either drop the class, or get the grade you deserve(F). If you genuinely want help, why not try something and post what you came up with here? If you are inexperienced we will help you out as long as you are willig to do some work.
- 07-28-2011, 07:51 AM #11
I tried to help. I tried to provide advice on the best way to get help. I tried to nudge and guide you into at least making a start. But you seem intent on being nothing more than being rude and ignorant. With that attitude you will not only fail your class but fail in life as well.
- 07-28-2011, 07:54 AM #12
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Seems this thread not discussing anything useful.
- 07-28-2011, 07:59 AM #13
I don't really know what to do this is all I've got.
Java Code:import cs1.Keyboard; public class TeamHeight { public static void main (String[] args) { //totalHeight = 0; int arrayElements[]={0, 0, 0, 0, 0}; do { System.out.print("Enter heights"); Keyboard.readInt(); } while (in counter=0;counter<arrayElements.length) { System.out.print("Heights:" +index(arrayElements); } } }
- 07-28-2011, 08:01 AM #14
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Ok, that's the way to move.
What will print your code when it compiles and run?
- 07-28-2011, 08:03 AM #15
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Just looking at your code, I wonder on one thing. How long you are studying Java. Do you have knowledge of any other languages such as C# and so on.
- 07-28-2011, 08:03 AM #16
At last! You made an attempt at writing the code yourself. Unfourtunately you have wasted your chance as I have no intention of helping you ever!
- 07-28-2011, 08:40 AM #17
- 07-28-2011, 04:42 PM #18
Man, I'm surprised people are still willing to help you. They gave you good advice when you originally asked, but you want someone to do the work for you. We don't do that here.
I suggest reading these in order I posted them, I promise you will learn a lot if you actually read them:
Variables (The Java™ Tutorials > Learning the Java Language > Language Basics)
Lesson: Classes and Objects (The Java™ Tutorials > Learning the Java Language)
Arrays (Java Platform SE 6)
Scanner (Java Platform SE 6)- Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
- +Rep people for helpful posts.
- 07-28-2011, 05:55 PM #19
Remember to increment your counter variable or you'll never get out of that loop thus forcing the program to do something unwarranted, i.e. not work. Hang in there man, and don't give up. I was in your shoes 5 years ago. Nobody helped me, I was bitter, but eventually I just had to train myself to learn it on my own. Then, one day I stumbled across this magical land known as Google and got any development questions answered (seemingly) the same day. All it took was for me to try writing code, building, compiling, debugging, and then (hopefully) running. Remember, as engineers we are not just asking questions, we're guess-and-checking as well. Trial and error is not only a great way to learn, it's also an excellent way to pass the day at work so I can get in my 8 hours. Lastly, check out the The Really Big Index which covers every part of Java known to the universe. ˇBuena suerte!
- 07-28-2011, 06:55 PM #20
Here is a decent article at Oracle's website that talks about arrays:
Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
There is example code as well.
Your instructor is talking about arrays and your class has no idea of how to write say a Hello World Java program.
See, the OP brought ZERO to the table and I didn't do his work for him!!!!!! This is a person that wants someone to do their work for them. I do know the difference.
Similar Threads
-
Recursively find average of an integer arrray
By fam2315 in forum New To JavaReplies: 1Last Post: 06-21-2011, 03:25 AM -
finding average in 2d arrays
By the beginner in forum New To JavaReplies: 18Last Post: 02-24-2011, 04:32 AM -
Find the sum of two numbers that are from two different arrays.
By bMorgan in forum New To JavaReplies: 8Last Post: 02-08-2011, 07:27 AM -
Sending Arrays into methods then dividing for an average.
By freebirdcal in forum New To JavaReplies: 8Last Post: 02-03-2011, 10:41 PM -
Need help to find average
By kevinsoto in forum New To JavaReplies: 4Last Post: 11-04-2010, 01:54 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks