expand icon
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
Exercise 3

If productCost and productPrice are numeric variables, and productName is a string variable, which of the following statements are valid assignments? If a statement is not valid, explain why not.

a. productCost = 100

b. productPrice = productCost

c. productPrice = productName

d. productPrice = "24.95"

e. 15.67 = productCost

f. productCost = $1,345.52

g. productCost = productPrice - 10

h. productName = "mouse pad"

i. productCost + 20 = productPrice

j. productName = 3-inch nails

k. productName = 43

l. productName = "44"

m. "99" = productName

n. productName = brush

o. battery = productName

p. productPrice = productPrice

q. productName = productCost

Step-by-step solution
Verified
like image
like image

Step 1 of 18

Here, the numeric variables are “productCost” and “productPrice”, and string variable is “productName”.

a.

The numeric variable can hold the values of digits. So, the numeric value “100” is assigned to numeric variable of “productCost”.

Therefore, the assignment statement “productCost = 100” is     <div class=answer> Here, the numeric variables are “productCost” and “productPrice”, and string variable is “productName”. a. The numeric variable can hold the values of digits. So, the numeric value “100” is assigned to numeric variable of “productCost”. Therefore, the assignment statement “productCost = 100” is   . .


Step 2 of 18


Step 3 of 18


Step 4 of 18


Step 5 of 18


Step 6 of 18


Step 7 of 18


Step 8 of 18


Step 9 of 18


Step 10 of 18


Step 11 of 18


Step 12 of 18


Step 13 of 18


Step 14 of 18


Step 15 of 18


Step 16 of 18


Step 17 of 18


Step 18 of 18

close menu
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
cross icon