Write Java statements that accomplish each of the following tasks (Notice: Don’t
ID: 3594604 • Letter: W
Question
Write Java statements that accomplish each of the following tasks (Notice: Don’t create the whole program.):
a. Display an input dialog box asking the user to enter a double number. (Notice: Named your own variable name.)
b. Convert a String variable named firstNumber to a double number, and store the result in the double variable named num.
c. Display a dialog box containing the message “My name is ” followed by the value of the variable firstName and lastName, and separated by one space between two variables. (i.e. My name is John Smith)
Explanation / Answer
a)
double dNum;
System.out.println("Enter a double number(dNum): ");
b)
num = Double.parseDouble(firstnumber);
c)
String firstName = "Chegg" , lastName = "India";
System.out.println("My name is "+firstName+" "+lastName);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.