Link to home
Create AccountLog in
Avatar of Robert Ehinger
Robert EhingerFlag 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?



Chapter 3:      Bill's Burgers Sales Tax Calculator
Programmer:      Robert Ehinger
Date:            February 19, 2010
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()
                  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;

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.");

Avatar of robthewolf
Flag of Israel image

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


Where do I add that? I tried at the beginning and at the end and neither works.
Avatar of robthewolf
Flag of Israel image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account