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) weight1PTOKG);
EasyWriter screen = new EasyWriter();
screen.println("hi u");
screen.println(weightinkg3,3,0);
}
}
#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)
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);
}
}
what's the question?
How to print” hi u” and weightinkg3,3,0 in same line when running
Weightinkg3,3 while ,3 mean to 3 decimal place
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
do print instead of println
just replace println with print
ok