can u please answer me this question in java language ? I would like to have som
ID: 3910339 • Letter: C
Question
can u please answer me this question in java language ?
I would like to have some information printed out. What is the full print statement to do this if I DO want to format my data, and DO want a new line printed out after the statement. The statement I would like to have printed:
Hello, today is <DATE> and the temperature is: <CURRENT TEMP> <DEGREE SYMBOL> F
Here are the requirements:
DATE is stored in a string called date,
CURRENT TEMP is stored in a double called currentTemp
DEGREE SYMBOL is stored in a char called degreeSymbol
I want the temperature printed to only two decimal points.
Note that at the end there is a capital F, that needs to be printed, that is the F for fahrenheit.
This is a once statement answer, assume all variables are declared and have valid values, I am just asking you to write me the print statement.
Explanation / Answer
import java.util.*;
public class Main
{
public static void main(String[] args)
{
char degreeSymbol = 'u00b0';
String date = "28-June-2018";
double currentTemp = 96;
System.out.printf("Hello, today is %s and the temperature is: %.2f%cF ",date,currentTemp,degreeSymbol);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.