For this assignment, you are required to develop an application to enable a user to rate a restaurant. A rating is a real number between 1 and 5 inclusive, where 1 is the lowest rating and 5 is the highest rating.

The application should work as follows:

The application (i.e. not the user!) sets the following numbers:

  • MAX_NUM_ITEMS is the maximum number of items
  • MAX_NUM_RATINGS is the maximum number of ratings that could be provided for each item

At the start of the application, the application should display on the screen the type of items a user can provide information for (i.e. based on the item type assigned to you in section Instructions and Checklist). The application should also display on the screen the maximum number of items that the user could provide information for, and the maximum number of ratings that could be provided for each item.

Next, the application should display on the screen the functionalities that the application provides, in a menu/format similar with the one shown in Table 1. Next, the application should prompt the user to enter their choice. The application should allow a user to repetitively use the available functionalities until the user decides that they want to exit the application.

Table 1 Application Menu

Application Menu ... For Item Type: XYZ (replace XYZ with the Item Type assigned to you in section Instructions and Checklist)
1 - Add an item
2 - Display all the items
3 - Add a rating for a given item
4 - Display all the ratings for a given item
5 - Calculate and display the average rating for each item
6 - The functionality assigned to you in section Instructions and Checklist
7 - Exit application
Enter your choice:

Note that arrays should be used to store all the items provided by the user and all the ratings provided for a given item. IMPORTANT: For these tasks you should only use arrays (you should not use other data structures that were not covered within the module).

The functionalities that the application must provide are as follows:

1. Add an item

  • The user provides/enters information about a new item, and the item is added to the array of items.
  • Note that validation must be performed such that a user cannot provide more items than the maximum number of items set by the application (i.e. MAX_NUM_ITEMS).

2. Display all the items

  • The application should display all the items entered so far. If there are no items, the application should display a message to inform the user of the same.

3. Add a rating for a given item

  • The user provides the name of the item they wish to provide a rating for, and the rating. The rating is added to the array of ratings for the given item.
  • Validation should be performed such that the user is informed if they want to provide a rating for an item that does not exist. Validation must be performed such that a user cannot provide more ratings per item than the maximum number of ratings set by the application (i.e. MAX_NUM_RATINGS).

4. Display all the ratings for a given item

  • First, the user provides the name of an item. Next, the application displays all the ratings for that item. If the item has no ratings, the application displays a message to inform the user of the same.
  • Validation should be performed such that the user is informed if they provide an item that does not exist.

5. Calculate and display the average rating for each item

  • The application calculates the average rating for each of the items based on the ratings received per item.
  • The application should display each item and its corresponding average rating in the format item name - average rating:

6. The functionality assigned to you in section Instructions and Checklist

  • The functionality that you should implement has been assigned based on the last digit of your student ID number. Please check the section Instructions and Checklist to find the functionality assigned to you.

7. Exit application

  • The application should allow a user to repetitively use all the available functionalities until the user decides that they want to exit the application. When the user enters 7 the application should finish its execution.

Note that the application should work irrespective of how the user provides the data i.e. using upper case letters, lower case letters or a combination of both upper case and lower case letters.

Validation should be performed for all the user input, and if invalid input is provided the application should display a corresponding message to inform the user.

Your application should make use of instantiable classes and demonstrate your ability to use other programming concepts, which we have covered in the Software Development module.

Instructions and Checklist

Please follow the instructions. Ensure that you complete each of the following checklist items:

a) The application should enable a user to provide information about restaurants, and provide reviews for these restaurants.

b) Maximum number of items and maximum number of ratings: Define two constants in your application for the maximum number of items that could be provided, and the maximum number of ratings that could be provided for each item. Assign a value of your choice to each of the two constants that is at least 3.

c) Functionality: Display the worst item based on the average rating (i.e. the item with the lowest average rating).

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.