Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

storing user defined variables in an array

 
Mike Pirrone
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you thinking that someone is going to write the code and complete your homework for you?
 
Mike Pirrone
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using this...
------------------------------------------------

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

(Marilyn added code tags for readability)
[ March 01, 2002: Message edited by: Marilyn deQueiroz ]
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please somebody should make sincere comment on the sample code I suggested to Mike Pirrone - we're all learning.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic