• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Array Help  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a mini user information management system that asks the user to enter an employee's first name, last name, and salary. When the user clicks on a Confirm button, the information entered will be displayed to the user cummulatively. E.g. if the user enters the first employee, and clicks on the button, one employee information will be displayed. If the user enters another employee and clicks on the button, the information for two employees will be displayed. Hint: you will need to create three arrays and assign values to them.

Things to think about before you start:
1. Why do we need three arrays?
2. How to use three arrays to store information?
3. How to make the arrays keep the previous information between button clicks?
4. How to retrieve all the information when the button is clicked?
5. How to make sure the information for each employee is correct? i.e. the first name, last name and the salary for an employee is correct (no cross reference).

These are the directions that I have. This is the code I've tried to do. I can get the first employee to display, but I'm not sure how to create the loop which allows me to add in more users. Any help would be greatly appreciated. Thanks!
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jake, welcome to the Ranch!

Before trying to answer the question, I have a question for you. Were you supposed to write Java code or Javascript code for this assignment? I ask because they aren't the same thing, you've written Javascript code, but you've posted the question in one of our Java forums.
 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jake Rietow wrote:This is the code I've tried to do.

Jake, please DontWriteLongLines (←click); they make your posts very hard to read.

I've broken up the worst one (line 21) - hopefully it's still valid - but the fact is that the code tags here were designed for Java code, not Javascript or HTML.

Winston
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jake Rietow wrote: . . . Hint: you will need to create three arrays and assign values to them. . . .
I would go back and query that. Are you running parallel arrays? That would be a dreadful bit of design. Java is an object language, so you should be creating objects. In this case, maybe Employee objects. You can put them into an array, but you will have one array of them.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!