arrays

Z

zeus2

how do i create data storage for an array of integers, and for an
integer variable size
-Prompts the user for the size of array they want (number of elements)
-Instantiates the array to have the number of elements the user
requested.
- Prompts the user to enter a value to store in each element of the
array
Uses methods from the Array class to:
- Sort the elements of the array into numerical order
- Display the sorted values on the console.
 
R

Roedy Green

how do i create data storage for an array of integers, and for an
integer variable size
-Prompts the user for the size of array they want (number of elements)
-Instantiates the array to have the number of elements the user
requested.
- Prompts the user to enter a value to store in each element of the
array
Uses methods from the Array class to:
- Sort the elements of the array into numerical order
- Display the sorted values on the console.

see http://mindprod.com/jgloss/homework.html
http://mindprod.com/jgloss/gotchas.html#ARRAY
 
A

Adam Maass

how do i create data storage for an array of integers, and for an
integer variable size
-Prompts the user for the size of array they want (number of elements)
-Instantiates the array to have the number of elements the user
requested.
- Prompts the user to enter a value to store in each element of the
array
Uses methods from the Array class to:
- Sort the elements of the array into numerical order
- Display the sorted values on the console.

Homework. Do it yourself.

-- Adam
 
M

Malte

how do i create data storage for an array of integers, and for an
integer variable size
-Prompts the user for the size of array they want (number of elements)
-Instantiates the array to have the number of elements the user
requested.
- Prompts the user to enter a value to store in each element of the
array
Uses methods from the Array class to:
- Sort the elements of the array into numerical order
- Display the sorted values on the console.

You forgot this:

- get others to do my homework for me
 
Z

zeus2

i have studied very hard dickhead! Arrogant arsehole!!!!i am asking for
suggestions!
 
R

Roedy Green

i have studied very hard dickhead! Arrogant arsehole!!!!i am asking for
suggestions!

But the point is you have done no work yourself. You have asked no
questions. You are effectively playing helpless female trying to suck
someone into doing your homework or spoon feed you, hence totally
subverting your education. The guy you are so angry with was trying
to stop you from harming yourself.

You don't realise how counterproductive to your own welfare what you
did is, both in terms of hurting your education and getting aid.

Please look at the link http://mindprod.com/jgloss/homework.html

It is full of useful information about how to get help rather than
rude responses, how to tackle the problem on your own, and the cons of
doing what you did.
 
B

Bjorn Abelli

how do i create data storage for an array of integers,
and for an integer variable size

Look up in your course book on how to *declare* variables, and take a
special look about it in the chapter concerning arrays.
-Prompts the user for the size of array they
want (number of elements)

Look up in your course book on how input and output via the console works.
-Instantiates the array to have the number of elements the user
requested.

Look up in your course book on how to assign values to already declared
variables, especially in the chapter concerning arrays.
- Prompts the user to enter a value to store
in each element of the array

See answer to question 2, and how to make iterations (loops).
Uses methods from the Array class to:
- Sort the elements of the array into numerical order

Look up in your course book on how to use the class library the JDK
provides.

Then you can look up in the API-documentation what method is most suited for
the task.

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html
- Display the sorted values on the console.

See answer to question 4.

I would also suggest that you post questions like this in the group
comp.lang.java.help instead.

It's a part of the netiquette to choose the most appropriate group for
postings, or you can easily, and rightfully be flamed for different reasons.

This group is *not* the best forum for newbie questions.

I must say that if you *really* had studied hard, you would at least have
come up with some preliminary code to show, and then have more specific
questions to ask.

If you *anyway* have studied hard, maybe programming isn't where your future
lies...

// Bjorn A
 
T

Tor Iver Wilhelmsen

i have studied very hard dickhead! Arrogant arsehole!!!!i am asking for
suggestions!

You're in the wrong neighborhood. In World of Warcraft terms:

comp.lang.java.help: Normal server.

comp.lang.java.programmer: PVP server.

We eat homework posters with ketchup here.
 
S

Scott Ellsworth

i have studied very hard dickhead! Arrogant arsehole!!!!i am asking for
suggestions!

This post destroyed any lingering traces of goodwill I may have had for
you. You did not bother asking any actual questions, just parroted your
homework.

Try posting in c.l.j.help, but try this format instead.

'My homework assigment asks me to instantiate an array that has the
number of elements the user requested.

I googled for java array declaration, and at the very first link at Sun
in the java tutorial on arraybasics.html (Give the URL), it has the
following line of code:

<since I am annoyed, look it up for yourself>

I can't figure out how to get the number the user typed in into that
line of code.

I tried

public class A {
public static void main(String[] args) {
anArray = new int[numberOfElements];
}
}

and got the error

work@boggle:hibernate_and_spring$ javac A.java
A.java:3: cannot find symbol
symbol : variable anArray
location: class A
anArray = new int[numberOfElements];
^
A.java:3: cannot find symbol
symbol : variable numberOfElements
location: class A
anArray = new int[numberOfElements];
^
2 errors

Why is it complaining that it cannot find the symbol anArray - it is
right there on line 3?'

This shows that you actually did 'study very hard', unlike your first
post.

(NB - the above posted so the next student will consider looking
something up. Google is your friend.)

Scott
 
A

Adam Maass

how do i create data storage for an array of integers, and for an
integer variable size
-Prompts the user for the size of array they want (number of elements)
-Instantiates the array to have the number of elements the user
requested.
- Prompts the user to enter a value to store in each element of the
array
Uses methods from the Array class to:
- Sort the elements of the array into numerical order
- Display the sorted values on the console.

And now that I'm feeling more charitable, before you post something like
this again, read:

http://www.catb.org/~esr/faqs/smart-questions.html



-- Adam Maass
 
T

Thomas G. Marshall

(e-mail address removed) coughed up:
i have studied very hard dickhead! Arrogant arsehole!!!!i am asking
for suggestions!

All the suggestions to you here as to how to ask questions are good ones.

I'll only add that if you were to have shown nearly /any/ example of what
you had tried already, it would have helped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,614
Members
45,292
Latest member
EttaCasill

Latest Threads

Top