I want to output the annual salary for each employee individually but I'm not sure how. The way it is now it just pops up as one large box.

Any help is much appreciated :)

 public static void main(String[] args) {
        // TODO code application logic here

    String increase, 
            output = "";

    double percentIncrease, 

    for(int count = 1; count <= 10; count++ ){

        Salary = JOptionPane.showInputDialog("Enter Employee wage " + count );

        AnnualSalary = Double.parseDouble(Salary);

        increase = JOptionPane.showInputDialog("Enter Percentage Increase for Employee " + count);

        percentIncrease = Double.parseDouble(increase);

        for(int year = 1; year <= 4; year++ ){

             AnnualSalary += ( percentIncrease / 100 )* AnnualSalary;

             output += "The new salary for year " +  count  + " is " +  + AnnualSalary + "\n";



    JOptionPane.showMessageDialog(null, output);


Recommended Answers

All 2 Replies

did you write this code yourself ? somehow, it seems to me that if you did, you would have know how to do so.

in your iteration, don't add the text to print to a variable called output, just put the JOptionPane.showMessageDialog as last command in the loop, and replace the 'output' variable by the text to print.

commented: My tutor help me out with the code but did not in to detail about the output message, that and I'm a bit rusty after the Christmas break +0

you said, "I want to output the** annual** salary ".It means in your output message you should include the the variable that is storing this value.
for example:System.out.println(myAnnualVariable);. However, in your case use

commented: Thanks for the help :) +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.