Answer:
Case-Based Critical Thinking Questions
Case 1 - Tony’s Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
Daily “Chef’s Specials” are stored using two one-dimensional parallel arrays. The days of the week are stored in the strDays array, with Sunday as the first element. The daily special for each day is stored in a parallel array named strSpecial. Which of the following statements assigns Friday’s special, which is rigatoni, to the appropriate element?
a. strSpecial(5) = "rigatoni"
b. strSpecial(6) = rigatoni
c. strSpecial(5) = rigatoni
d. strSpecial(6) = "rigatoni"
Explanation:
The bolded option is the correct answer; option A - strSpecial(5) = "rigatoni"
Two one-dimensional arrays are use; one for storing days of the week (strDays) and another for storing daily special (strSpecial).
Our concern is assigning rigatoni as a Friday's special. Array uses zero based index for counting; it start counting from zero, so, its first element is at index zero. Since Sunday is the first day; we have the following index:
Sunday = 0
Monday = 1
Tuesday = 2
Wednesday = 3
Thursday = 4
Friday = 5
Saturday = 6
Since, we are assigning rigatoni to Friday, we have:
strSpecial(5) = "rigatoni"