Avatar of Robert Ehinger
Robert Ehinger
Flag for United States of America asked on

Add a Blank Line oin JAVA output

Here is my current code for a currency conversion program. I would like to add a blank line between each of the output statements. How can I do that?

Thanks!!

Robert

/*
Chapter 3:      Bill's Burgers Sales Tax Calculator
Programmer:      Robert Ehinger
Date:            February 19, 2010
Filename:      CurrencyConversion.java
Purpose:       This projects calculates the sales tax on orders placed at Bill's Burger Front Counter.

*/

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

public class CurrencyConversionApplet extends Applet implements ActionListener
{


            //construct components
            Label welcomeLabel = new Label("Welcome to the Currency Conversion Calculator");
            Label costDollarsLabel = new Label("Please enter the number of dollars you want to convert: ");
                  TextField costDollarsField = new TextField (5);

            Button calcButton = new Button("Calculate");
            Label poundsLabel = new Label("Click the Calculate button to display the converted values.");
            Label eurosLabel = new Label();
            Label rublesLabel= new Label();
            //declare variables
      Image logo; //declare an image object

            public void init()
            {
                  setForeground(Color.green);
                  add(welcomeLabel);
                  add(costDollarsLabel);
                  add(costDollarsField);
                  add(calcButton);
                  calcButton.addActionListener(this);
                  add(poundsLabel);
                  add(eurosLabel);
                  add(rublesLabel);
                  logo = getImage(getDocumentBase(), "logo.gif");
      }
            public void actionPerformed(ActionEvent e)
            {
double costDollars=Double.parseDouble(costDollarsField.getText());

//Declare variable

            double Dollars;
            double pounds;
            double euros;
            double rubles;
            Dollars=costDollars;

poundsLabel.setText("Your currency is equivalent to " + Math.round(Dollars*0.646329) + " pounds.");

eurosLabel.setText("Your currency is equivalent to " + Math.round(Dollars*0.735673) + " euros.");

rublesLabel.setText("Your currency is equivalent to " + Math.round(Dollars* 29.950) + " rubles.");

      }
}
JavaWeb Servers

Avatar of undefined
Last Comment
robthewolf

8/22/2022 - Mon
robthewolf

Have you tried adding \n to your string statements?
Robert Ehinger

ASKER
Where do I add that? I tried at the beginning and at the end and neither works.
ASKER CERTIFIED SOLUTION
robthewolf

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck