display multiple outputs in applet

Hi-
I'm sure this is simple - but I cannot seem to resolve it, or find the right answer.  I have a jave applet project to calculate a car loan.  I have it done and it is working EXCEPT....
Each calculation is correct and displays if I comment out the other 2.
   When I leave all 3 - just the last output shows...
I need all 3 output lines to show on my project... I've tried some different append syntax - but not finding the right ones...get nothing but errors.
I'd sure appreciate any recommendations ...thanks in advance!
Here's my code:

import java.awt.*;
import java.applet.*;
import java.awt.event.*;  //import three

public class carLoanApplet2ND extends Applet implements ActionListener   //action is ActionListener - extends means to expect
{

  Label Title = new Label("Car Loan Calculator"); //title is the variable-name it anything
   Label costCarLabel = new Label ("Please enter the Price of the Car:"); //this is a prompt label
   TextField costCarField = new TextField(25); //this is a text box -25 characters
   Label downPaymentLabel = new Label ("Please enter the down payment:"); //this is another prompt
   TextField downPaymentField = new TextField(25); //text field to get data
   Label loanPeriodLabel = new Label ("Please enter the Loan Period in Years:"); //this is another prompt
   TextField loanPeriodField = new TextField(25); //text field to get data

   Button calcButton = new Button("Calculate Car Payment");  //button name label is in " "
   Label outputLabel = new Label ("Enter the data and then click the button");

   public void init()
   {
      // Set Background color to cyan
      setBackground(Color.pink);
      add(Title); // display title
      add(costCarLabel);  //display label
      add(costCarField);
      add(downPaymentLabel);
      add(downPaymentField);
      add(loanPeriodLabel);
      add(loanPeriodField);

      add(calcButton);
      add(outputLabel);
      calcButton.addActionListener(this);  //add button that states action performed - calls method
   }

   public void actionPerformed(ActionEvent e)  //this is calculation method
   {
    double costCar, downPayment, loanPeriod, loan, interest, payment;  //pass values
    //Converting input to values
    costCar =(double)Integer.parseInt(costCarField.getText()); //convert to value
    downPayment = (double)Integer.parseInt(downPaymentField.getText());
    loanPeriod = (double)Integer.parseInt(loanPeriodField.getText());

    //Calculation amount of loan
    loan = costCar - downPayment;

     //Calc interest
     if (loan < 5000)
        interest = .089;
        else
        if (loan < 7500)
            interest = .079;
            else
            if (loan < 8500)
                interest = .069;
                  else
                  if (loan < 10000)
                           interest = .059;
                           else
                                interest = .039;

    //Calculate payment
    payment = ((loan*interest) + loan) / (loanPeriod*12);

    //Output loan amount
    outputLabel.setText ("The Loan Amount =  $" + loan);

    //Output interest
    outputLabel.setText ("The Interest Rate is = " + interest);

    //Output payment
    outputLabel.setText ("The Loan Payment is =  $" + Math.round(payment));


   }
}


THANKS!!!!!!!
vonbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozymandiasCommented:
Why are you using a Label to show the output ?

If uou have to use a labelmthen why not use three position one under the other , and do :

outputLabel2.setText ("The Loan Amount =  $" + loan);
outputLabel2.setText ("The Interest Rate is = " + interest);
outputLabel3.setText ("The Loan Payment is =  $" + Math.round(payment));
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
objectsCommented:
You are outputting results to the same label, so each overwrites the previous.
Either use 3 different labels as suggested by ozy, or use a TextArea with 3 lines and append each result on a new line.
0
vonbAuthor Commented:
Thanks -
The Label to show output was part of the assignment...
Thanks -You so much - I should have seen that, especially since only my last output was appearing....
thanks for helping me out!
cb
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.