• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Java Array Help

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28328
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79969
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic