Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Help with Output.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello~

I feel like I'm overlooking something very simple.
But I've been working on this assignment for hours already and I still don't get how I'm able to do it.
Anyways, the whole assignment is to revise a code. To add make the user add data. And that I' am required to write a GUI program instead of a console program.
I think I've done most of it right...
But I'm just blocked as to how I'm going to finish it. I've already searched so many forums but they've been only giving me simple solutions that is all under one class.

So the assignment tells me that:
After all data are entered, loop through the array again and output the payroll by calling employee.toString() and employee.earnings().

Ok, so that means I have to create the same for statement as I used for the code below right?

But I'm just stumped on how I'm going to do that.

Also he wants me to Append the output into a String.
JOptionPane.showInputDialog
Which means (firstName+ " " + lastName) So adding a space in between it.

And call JoptionPane.showMessageDialog() after the loop.
I was able to call the output, but how 'am I able to Append the String firstName, String lastName is in a different class.

To be honest, I'm just so lost in my Java online class... Its not really a class when I don't get to learn anything and its disappointing when I really wanted to learn, and be proficient at it. He just makes us read the book and do the assignments, and if we do ask questions he makes us read the book again.

Here are the codes:












 
Marshal
Posts: 8886
638
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Ann Frank wrote:the whole assignment is to revise a code...
I think I've done most of it right...

Revised it rightly? Misunderstood if you wrote it or you have been given all this. Nevermind.

Ann Frank wrote:So the assignment tells me that:


Instructions wrote:
After all data are entered, loop through the array again and output the payroll by calling employee.toString() and employee.earnings()

What exactly you don't understand from the sentence above?

Please show us your attempt and the outcome:
1. Inputs
2. Expected outputs
3. Actual outputs
4. Errors if any (copy/paste)
 
Ranch Hand
Posts: 99
1
Eclipse IDE MySQL Database Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ann Frank wrote:After all data are entered, loop through the array again and output the payroll by calling employee.toString() and employee.earnings().

Ok, so that means I have to create the same for statement as I used for the code below right?

If I get time I'll take a look at all of your code. For now though I'll say just this...use an enhanced for loop when processing an array, especially if you're just reading and not manipulating array content i.e.
 
Ann Frank
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:Welcome to the Ranch.

Ann Frank wrote:the whole assignment is to revise a code...
I think I've done most of it right...

Revised it rightly? Misunderstood if you wrote it or you have been given all this. Nevermind.

Ann Frank wrote:So the assignment tells me that:


Instructions wrote:
After all data are entered, loop through the array again and output the payroll by calling employee.toString() and employee.earnings()

What exactly you don't understand from the sentence above?

Please show us your attempt and the outcome:
1. Inputs
2. Expected outputs
3. Actual outputs
4. Errors if any (copy/paste)



Thank You, and I'm sorry for the confusion. What I meant is that the Assignment wants to Modify it.

These are the codes that I added to it and the rest was given.





What exactly you don't understand from the sentence above?


After all data are entered,
The data that was inputted because of employees[i]enterData(); right?
loop through the Array again, then output the payroll calling employee.toString() and employee.earnings().
So, Use a loop with the same array as employees[i].enterData(); then call employee.toString() and employee.earnings()?
How do I call employee.toString() and employee.earnings()?
So something like or ? It don't think this is right, plus it shows it as a console instead and in the GUI it doesn't do anything.

I'm sorry if I can't even understand this, I'm really annoyed at myself being able to grasp this.



 
Ann Frank
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clements wrote:

Ann Frank wrote:After all data are entered, loop through the array again and output the payroll by calling employee.toString() and employee.earnings().

Ok, so that means I have to create the same for statement as I used for the code below right?

If I get time I'll take a look at all of your code. For now though I'll say just this...use an enhanced for loop when processing an array, especially if you're just reading and not manipulating array content i.e.



Got it.
I changed it so now it looks like


It seems like the question asks me to just do what I did for emp.enterData(); like this:

But it seems too simple and I'm surely missing something because that doesn't change anything.
 
reply
    Bookmark Topic Watch Topic
  • New Topic