Hi All, thanks to ask me about last quetion. I forgot to tell you I found the so
ID: 3664913 • Letter: H
Question
Hi All, thanks to ask me about last quetion. I forgot to tell you I found the souliton for it. There are some questions in my homework. Could you plesse help me to undrstand them??
1_Suppose a phone number, stored as a ten-character string (of digits only) called phoneNumber, must be converted into a string that has parentheses around the area code. Which statement below will do that?
a. String newNumber = "(" + phoneNumber.substring(3, 0) + ")";
b. String newNumber = "(" + ")" + phoneNumber;
c. String newNumber = "(" + phoneNumber.substring(1, 3) + ")" + phoneNumber.substring(3, 7);
d. String newNumber = "(" + phoneNumber.substring(0, 3) + ")" + phoneNumber.substring(3, 10);
--------- ------------- -------------------------- ------------
Given the definition final double PI = 3.14159; which of the following is the Java equivalent of the mathematical expression c = radius2
c = PI * (radius * 2);
c = PI * Math.pow(2, radius);
c = PI * Math.pow(radius, 2);
c = Math.pow(PI * radius, 2);
a.c = PI * (radius * 2);
b.c = PI * Math.pow(2, radius);
c.c = PI * Math.pow(radius, 2);
d.c = Math.pow(PI * radius, 2);
Explanation / Answer
1_Suppose a phone number, stored as a ten-character string (of digits only) called phoneNumber, must be converted into a string that has parentheses around the area code. Which statement below will do that?
Answer:
d. String newNumber = "(" + phoneNumber.substring(0, 3) + ")" + phoneNumber.substring(3, 10);
Given the definition final double PI = 3.14159; which of the following is the Java equivalent of the mathematical expression c = radius2
Answer:
d. c = PI * Math.pow(radius, 2);