#then how to make last 2 lines to be printed in one line because this code run with no errors but I w

16 messages · Page 1 of 1 (latest)

trim wind
#

import sheffield.;
public class Assignment1 {
public static void main ( String [] args) {
// Now i declared a constant as 1pound = 0.453592kg
final double PTOKG = 0.453592;
// I used the class EasyReader to create an input
EasyReader weight = new EasyReader();
int weight1 = weight.readInt("Please type in a weight in pounds : ");
double weightinkg3 = ((double) weight1
PTOKG);
EasyWriter screen = new EasyWriter();
screen.println("hi u");
screen.println(weightinkg3,3,0);
}
}

ivory beaconBOT
#

Hey, @trim wind!
Please remember to /close this post once your question has been answered!

#
import sheffield.*;
public class Assignment1 {
    public static void main ( String [] args) {
        // Now i declared a constant as 1pound = 0.453592kg 
        final double PTOKG = 0.453592;
        // I used the class EasyReader to create an input
        EasyReader weight = new EasyReader();
        int weight1 = weight.readInt("Please type in a weight in pounds : ");
        double weightinkg3 = ((double) weight1*PTOKG);
        EasyWriter screen = new EasyWriter();
        screen.println("hi u");
        screen.println(weightinkg3,3,0);
    }
}
lyric gulch
#

what's the question?

trim wind
#

How to print” hi u” and weightinkg3,3,0 in same line when running

#

Weightinkg3,3 while ,3 mean to 3 decimal place

trim wind
#

Terminal output :

#

Please type in a weight in pounds : 123
hi u
55.792

#

how to make hi u and 55.792 in same line

amber urchin
#

do print instead of println

trim wind
#

how?

#

screen.print("hi u"+ weightingkg3,3,0)?

amber urchin
#

just replace println with print

trim wind
#

ok