What is wrong with this code?

``` float CalcCost( int unit )
{
float cost;
cost = 5.59 * unit;
return cost;
}```
A. The function name is invalid.
B. The return type should be int.
C. You can’t have math statements inside a function.
D. Nothing is wrong with it.


D

Computer Science & Information Technology

You might also like to view...

If TAX_RATE is a named constant of type Decimal, which of the following statements is valid?

(A) TAX_RATE += 1 (B) dblVar = TAX_RATE + 1 (C) TAX_RATE = 2 * TAX_RATE (D) All of the above

Computer Science & Information Technology

The type of control structure that causes a branch forward at some point, causing a portion of the program to be skipped, is:

a. a sequential structure b. a repetition structure c. a selection structure d. a loop structure

Computer Science & Information Technology

Computer scientists use the term __________ to describe the interconnections that link a computer’s components.

a. interface b. bus c. architecture d. none of the above

Computer Science & Information Technology

A field that obtains its data by using a formula to perform a calculation or computation

a. Appended field b. Short text field c. Calculated field

Computer Science & Information Technology