Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

No dynamic arrays or pointers allowed. C++. Thank you. Name City Ranking Uma Barcelona Viana Barcelona Blavis Barcelona My Restaui Barcelona Bodega Bia Barcelona Santa

image text in transcribedNo dynamic arrays or pointers allowed. C++. Thank you. image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Name City Ranking Uma Barcelona Viana Barcelona Blavis Barcelona My Restaui Barcelona Bodega Bia Barcelona Santa Rita Barcelona Rudi of Pire Barcelona Chaka Kha Barcelona Spoonik Re Barcelona The Box Barcelona OOOOO AWN- Rating Price Rang Number of Reviews 5.0 $$$$ 792 5.0 $$ - $$$ 2707 5.0 $$ - $$$ 643 5.0 $$ - $$$ 159 5.0 $$ - $$$ 1078 5.0 $$$$ 329 5.0 $$ - $$$ 110 5.0 $$ - $$$ 479 5.0 $$$$ 408 4.5 $ 834 Problem description Today you'll be working as a Trip Advisor software engineer. You'll help a user of your application to find a place to eat in Barcelona. The user is interested in restaurants sorted by (1) Name and (2) Ranking. Also, he/she wants to (3) find restaurants by a Name and (4) get the best restaurant with a given prices. You'll be given a ".csv" file in the following format: 5.0 Name City Santa Rita Experience Barcelona Uma Barcelona Spoonik Restaurant Barcelona Viana Barcelona Chaka Khan Barcelona The Box Barcelona Blavis Barcelona My Restaurant Barcelona Bodega Biarritz Barcelona Rudi of Pirate Cooking Barcelona Ranking Rating Price Range Reviews 6 $$$$ 329 5.0 $$$$ 792 5.0 $$$$ 408 5.0 $$ - $$$ 2707 8 $$ - $$$ 479 4.5 834 5.0 $$ - $$$ 643 5.0 $$ - $$$ 159 5.0 $$ - $$$ 1078 5.0 $$ - $$$ 110 5.0 Column descriptions: Name: Name of the restaurant. A string. City: Name of the city where the restaurant is located. A string. Ranking: Rank of the restaurant in a given city (e.g. restaurant with rank 1 is considered to be the best restaurant in a city it is located). An integer number. Rating: An average rating of the restaurant. A non-integer number. Price Range: Price range of the dishes. A string. Reviews: Number of review. An integer number. Reviews: Number of review. An integer number. This is a part of a database that you can find here. The database is stored in a CSV (comma-separated values) file. It's a file format used to store tabular data. Rows are separated with an endline symbol and individual values are separated by comma. Note, values stored cannot contain comma or endline symbol. Note, that unlike "flights.csv" from the previous assignment this file has col- umn names as a first row. Column names are always in the same See "restaurants.csv" for an example. Implementation The program should run in a while loop. Each iteration the program should ask to enter the menu option (1-5). Depending on the menu option the program should do the following: 1. Show all the restaurants in a database in a human readable for- mat sorted by a Name column. 2. Show all the restaurants in a database in a human readable for- mat sorted by a Ranking column. 3. Find restaurant by a Name using a binary search. 4. Read a price range then find the restaurant with the highest Ranking that has a given price range. For example, if the user inputs "$$" you should find restaurant with a name "Viana. The result will be the same if user enters "$$$". In another words, "$$ - $$$ means that restaurant has dishes with prices "$$" and "$$$. Note, that it is the highest ranking restaurant with price range $$ for city Barcelona. But it should work for other cities as well (".csv" files with a different content). 5. Exit the loop. The program should contain at least 7 functions (excluding main). 1. "readRestaurants". Given the file input stream, and empty array of restaurants, read the .csv file with restaurants and return a size of an array 2. "printRestaurants. Given the array of restaurants and its size it shows them in a human-readable format. 3. sort RestaurantsByRanking. Sorts an array of restaurants by Ranking column. 4. sort RestaurantsByName". Sorts an array of restaurants by Name column. 5. "binary SearchName". Given an array of restaurants sorted by Name, its size and a target name find a restaurant with a given name using binary search. Return its index or -1 if it's not found. 6. "isInPriceRange". Given the restaurant price range as a string and a target price (was entered by the user) computes whether a restaurant price range contains a target price. You can assume that a restaurant price range is "$", "$$ - $$$" or "$$$$". When a target price range is "$", "$$", "$$$" or "$$$$. 7. "find Best Restaurant WithPrice". Given the array of restaurants, its size and a target price previously entered by user, find the best restaurant (highest Ranking) with target price in its price range. Return the index of a the found restaurant or -1 if there are no restaurant with a target price. The easiest way to do it is to do a linear search in the array of restaurants sorted by Ranking. Note, you should use isInPriceRange" inside this function. IMPORTANT: don't use cin or cout inside functions that doesn't have read or print in a name (except for main() function). Do what function is supposed to do and print results outside. Note: you can assume that your input file has no more than 100 restaurants stored, so you can create an array of restaurants with 100 elements in it and then use only as many as you read from the file. Name City Ranking Uma Barcelona Viana Barcelona Blavis Barcelona My Restaui Barcelona Bodega Bia Barcelona Santa Rita Barcelona Rudi of Pire Barcelona Chaka Kha Barcelona Spoonik Re Barcelona The Box Barcelona OOOOO AWN- Rating Price Rang Number of Reviews 5.0 $$$$ 792 5.0 $$ - $$$ 2707 5.0 $$ - $$$ 643 5.0 $$ - $$$ 159 5.0 $$ - $$$ 1078 5.0 $$$$ 329 5.0 $$ - $$$ 110 5.0 $$ - $$$ 479 5.0 $$$$ 408 4.5 $ 834 Problem description Today you'll be working as a Trip Advisor software engineer. You'll help a user of your application to find a place to eat in Barcelona. The user is interested in restaurants sorted by (1) Name and (2) Ranking. Also, he/she wants to (3) find restaurants by a Name and (4) get the best restaurant with a given prices. You'll be given a ".csv" file in the following format: 5.0 Name City Santa Rita Experience Barcelona Uma Barcelona Spoonik Restaurant Barcelona Viana Barcelona Chaka Khan Barcelona The Box Barcelona Blavis Barcelona My Restaurant Barcelona Bodega Biarritz Barcelona Rudi of Pirate Cooking Barcelona Ranking Rating Price Range Reviews 6 $$$$ 329 5.0 $$$$ 792 5.0 $$$$ 408 5.0 $$ - $$$ 2707 8 $$ - $$$ 479 4.5 834 5.0 $$ - $$$ 643 5.0 $$ - $$$ 159 5.0 $$ - $$$ 1078 5.0 $$ - $$$ 110 5.0 Column descriptions: Name: Name of the restaurant. A string. City: Name of the city where the restaurant is located. A string. Ranking: Rank of the restaurant in a given city (e.g. restaurant with rank 1 is considered to be the best restaurant in a city it is located). An integer number. Rating: An average rating of the restaurant. A non-integer number. Price Range: Price range of the dishes. A string. Reviews: Number of review. An integer number. Reviews: Number of review. An integer number. This is a part of a database that you can find here. The database is stored in a CSV (comma-separated values) file. It's a file format used to store tabular data. Rows are separated with an endline symbol and individual values are separated by comma. Note, values stored cannot contain comma or endline symbol. Note, that unlike "flights.csv" from the previous assignment this file has col- umn names as a first row. Column names are always in the same See "restaurants.csv" for an example. Implementation The program should run in a while loop. Each iteration the program should ask to enter the menu option (1-5). Depending on the menu option the program should do the following: 1. Show all the restaurants in a database in a human readable for- mat sorted by a Name column. 2. Show all the restaurants in a database in a human readable for- mat sorted by a Ranking column. 3. Find restaurant by a Name using a binary search. 4. Read a price range then find the restaurant with the highest Ranking that has a given price range. For example, if the user inputs "$$" you should find restaurant with a name "Viana. The result will be the same if user enters "$$$". In another words, "$$ - $$$ means that restaurant has dishes with prices "$$" and "$$$. Note, that it is the highest ranking restaurant with price range $$ for city Barcelona. But it should work for other cities as well (".csv" files with a different content). 5. Exit the loop. The program should contain at least 7 functions (excluding main). 1. "readRestaurants". Given the file input stream, and empty array of restaurants, read the .csv file with restaurants and return a size of an array 2. "printRestaurants. Given the array of restaurants and its size it shows them in a human-readable format. 3. sort RestaurantsByRanking. Sorts an array of restaurants by Ranking column. 4. sort RestaurantsByName". Sorts an array of restaurants by Name column. 5. "binary SearchName". Given an array of restaurants sorted by Name, its size and a target name find a restaurant with a given name using binary search. Return its index or -1 if it's not found. 6. "isInPriceRange". Given the restaurant price range as a string and a target price (was entered by the user) computes whether a restaurant price range contains a target price. You can assume that a restaurant price range is "$", "$$ - $$$" or "$$$$". When a target price range is "$", "$$", "$$$" or "$$$$. 7. "find Best Restaurant WithPrice". Given the array of restaurants, its size and a target price previously entered by user, find the best restaurant (highest Ranking) with target price in its price range. Return the index of a the found restaurant or -1 if there are no restaurant with a target price. The easiest way to do it is to do a linear search in the array of restaurants sorted by Ranking. Note, you should use isInPriceRange" inside this function. IMPORTANT: don't use cin or cout inside functions that doesn't have read or print in a name (except for main() function). Do what function is supposed to do and print results outside. Note: you can assume that your input file has no more than 100 restaurants stored, so you can create an array of restaurants with 100 elements in it and then use only as many as you read from the file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

identify the major consequences of burnout, boredom and engagement;

Answered: 1 week ago

Question

4. How does eff ective listening diff er across listening goals?

Answered: 1 week ago