197k views
7 votes
Which of the following statements converts a String object named subtotalString to a double variable named subtotal?a.double subtotal = Double.toString(subtotalString);b.double subtotal = subtotalString.parseDouble;c.double subtotal = Double.parseDouble(subtotalString);d.double subtotal = (double) subtotalString

User Skohrs
by
4.7k points

1 Answer

7 votes

Answer:

double subtotal = Double.parseDouble(subtotalString);

Step-by-step explanation:

Required

Determine which method converts string object to double variable

From the question;

The string object is: subtotalString

The double variable is: subtotal

From the given options (a) to (d), the option that answers the question is:

double subtotal = Double.parseDouble(subtotalString);

And it follows the syntax:

[datatype] [variable-name] = [Data-type].parse[Datatype]([string-variable])

User Tira
by
4.9k points