This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes storing user defined variables in an array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "storing user defined variables in an array" Watch "storing user defined variables in an array" New topic
Author

storing user defined variables in an array

Mike Pirrone
Ranch Hand

Joined: Oct 30, 2001
Posts: 33
im writing a program that asks the user how many boxes they want. after that, the program asks the length for the first shape, then the height of the first shape, and then the length and height ofr the second shape and so on. how do i go by storing each value the user enters in the array and then displaying the images using a (*) character? here is my code so far. I have ran the program fine before but am still trying to figure out how to store them in an array and then printing out each image one by one. i've gotten help on this before and really appreciate everything.

thank you so much!
-mike-
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Mike,
Gee that code looks familiar ...
This time I won't show you any code just give you some hints. You should make use of an existing Java class that contains width and height class variables. Dimension comes to mind! Then you can use an array of those objects.
So, using psuedo code we can do something like:

Regards,
Manfred.
Mike Pirrone
Ranch Hand

Joined: Oct 30, 2001
Posts: 33
do you have an email or AIM i could contact yo0u at? you have been very helpful. I'll have the code changed to height and width because as you've said before, it is confusing. thanks

-mike-
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Are you thinking that someone is going to write the code and complete your homework for you?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Mike Pirrone
Ranch Hand

Joined: Oct 30, 2001
Posts: 33
what is your problem? damn.. im not trying to find answers and someone to do my homework. what insult! im taking java because I want to learn it and become certified in the forseeable future. its nice to know that someone can be nice about things and help me out.
Yakubu Lawan
Greenhorn

Joined: Jan 23, 2002
Posts: 7
Try using this...
------------------------------------------------

------------------------------------------------
lawanyakubu@yahoo.com

(Marilyn added code tags for readability)
[ March 01, 2002: Message edited by: Marilyn deQueiroz ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by Mike Pirrone:
im taking java because I want to learn it and become certified in the forseeable future.


Rather than have you submit your problem and we say "fine - here is the code solution", some think that understanding comes from struggling with the issues a bit. Manfred tried to give you hints for you to struggle with. Eventually, someone will just give you the answer - thus robbing you of an education.

I'm sorry you felt insulted.
[ February 28, 2002: Message edited by: Marilyn deQueiroz ]
Mike Pirrone
Ranch Hand

Joined: Oct 30, 2001
Posts: 33
Thank you everyone for all the help. I really appreciate it. I did not mean to intentionally ask for specific code as answers and I will make sure to only ask for hints. Example: I had no idea a Dimension class existed and this has helped me greatly. Believe me, I am not getting robbed of my education. I'm sure you have all heard this before buy my professor is still attempting to get certified and he has only been teaching the course for over a year and honestly.. at times it seems like he has no idea what he is doing. If it wasn't for this website along with van der Linden's Just Java book, I would be truly lost.
Yakubu Lawan
Greenhorn

Joined: Jan 23, 2002
Posts: 7
Please somebody should make sincere comment on the sample code I suggested to Mike Pirrone - we're all learning.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: storing user defined variables in an array