Description Create a node struct that will store a restaurant review. Create two data fields: (1) a float, representing the numerical review on a scale from 0-5; and (2) a string, representing the...


Description


Create a node struct that will store a restaurant review. Create two data fields: (1) a float, representing the numerical review on a scale from 0-5; and (2) a string, representing the review's comments. Of course, since this is a linked list, you'll need another member variable, a pointer to point to the next struct object.


Ask the user to enter their choice: creating a linked list that adds new nodes at the head of the linked list, or at the tail:


Which linked list method should we use?
[1] New nodes are added at the head of the linked list
[2] New nodes are added at the tail of the linked list
Choice:

Then, using that struct, create a linked list using the method that the user has selected.


Your code should have a code block/function for entering data into the linked list. The user enters this data into the linked list. This data entry process should be in a loop, and the loop should continue as long as the user desires entering additional node data (which consists of both a review rating and comment). When they elect to quit entering data, your code should output the contents of the entire linked list. Your code should ensure the user enters at least one review.


Input validation


Your code should catch these input errors at a minimum:



  • Method selection

  • The review's numerical rating (0-5)


Sample output


You can always improve on this sample output, but your output must at a minimum meet this:


Which linked list method should we use?
[1] New nodes are added at the head of the linked list
[2] New nodes are added at the tail of the linked list
Choice: 1
Enter review rating 0-5: 3.5
Enter review comments: An excellent restaurant.
Enter another review? Y/N: y
Enter review rating 0-5: 4.5
Enter review comments: Stellar menu.
Enter another review? Y/N: y
Enter review rating 0-5: 2.2
Enter review comments: Had rats but good food I guess
Enter another review? Y/N: n
Outputting all reviews:
> Review #1: 2.2: Had rats but good food I guess
> Review #2: 4.5: Stellar menu.
> Review #3: 3.5: An excellent restaurant.
Sep 16, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here