Question: 2. 2. Write a function randomRestaurant that prints out a list of starters and main courses for the user, and then makes a random recommendation

 2. 2. Write a function randomRestaurant that prints out a list

2. 2. Write a function randomRestaurant that prints out a list of starters and main courses for the user, and then makes a random recommendation of one starter and one main course. The names of the starters and main courses are held in two arrays, with the length of these arrays also recorded. As random numbers are being used, include randomSeed (analogRead(O)); in setup(). To help you with this, you should write a helper function printOutFood that takes two parameters (a String array of food names and an integer for the array's length) and then prints the food names to Serial separated by two spaces each for clarity. You will then use this function in randomRestaurant. Include comments in your code to explain what is happening. The example below shows how your function should behave: (30 marks) // declared globally const int starter Num = 6; String starter [starterNum] = {"bread", "olives", "pate", "soup", "selection of cheeses", "croquettes"); const int mainNum = 7; String mainCourse [mainNum] = {"burger", "spaghetti bolognaise", "caesar salad", "salmon", "lasagne", "pizza", "curry" }; // in your setup() function randomSeed (analogRead(0)); randomRestaurant(); // in the Serial Monitor: (the random parts may be different of course) Welcome to the Restaurant Arduino For our starters we have: bread olives pate soup selection of cheeses croquettes And for our main course we have: burger spaghetti bolognaise caesar salad salmon lasagne pizza curry May I recommend the olives for the starter, and the caesar salad for the main course. 2. 2. Write a function randomRestaurant that prints out a list of starters and main courses for the user, and then makes a random recommendation of one starter and one main course. The names of the starters and main courses are held in two arrays, with the length of these arrays also recorded. As random numbers are being used, include randomSeed (analogRead(O)); in setup(). To help you with this, you should write a helper function printOutFood that takes two parameters (a String array of food names and an integer for the array's length) and then prints the food names to Serial separated by two spaces each for clarity. You will then use this function in randomRestaurant. Include comments in your code to explain what is happening. The example below shows how your function should behave: (30 marks) // declared globally const int starter Num = 6; String starter [starterNum] = {"bread", "olives", "pate", "soup", "selection of cheeses", "croquettes"); const int mainNum = 7; String mainCourse [mainNum] = {"burger", "spaghetti bolognaise", "caesar salad", "salmon", "lasagne", "pizza", "curry" }; // in your setup() function randomSeed (analogRead(0)); randomRestaurant(); // in the Serial Monitor: (the random parts may be different of course) Welcome to the Restaurant Arduino For our starters we have: bread olives pate soup selection of cheeses croquettes And for our main course we have: burger spaghetti bolognaise caesar salad salmon lasagne pizza curry May I recommend the olives for the starter, and the caesar salad for the main course

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!