Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In C++

For this assignment, you will create a system for users to review restaurants. To review a restaurant, the user needs to login to the system first. Create a file (you can do this by hand rather than through code) named 'users.txt' and add the following information to it:

User1 password steve mypassword reviewer 54321

Each line represents a user. The first word is their username and the second is their password.

At the start of your main function, call a function named login, which asks for a username and password. If you find a matching username/password pair in 'users.txt', return the username. Otherwise, ask the user to try again.

Back in main, assign the value returned from login to a variable. This will allow you to know which user is currently logged in. Next, build a while loop menu with the following options:

•Review a restaurant. Call a function named reviewRestaurant. Ask what restaurant the user wants to review and how many stars to give it. The star amount must be between 0 and 5 stars, and you may assume the user will only enter one-word restaurant names. Append the review to reviews.txt in the following way:

UserName Restaurant StarRating

For example, if User1 is logged in and they review McDonald's with 3 stars, append the following

User1 McDonald's 3

Note: write a helper function named alreadyReviewed. It returns true if the logged in user has already reviewed the given restaurant. If they have, do not append the new review to the file.

⚫ See all reviews from all users in the system for all restaurants. Call a function named seeReviews which loads the data from reviews.txt and prints them to the console. Label each piece of information, i.e.:

Restaurant: McDonald's

User: User1

Rating: 3

⚫ Find the average score for a restaurant. Call a function named seeAverage. In this function, ask the user which restaurant they want to see the average rating for. Calculate the restaurant's average star rating from all users if it has one or more reviews or tell the user there are no reviews for it otherwise.

• Quit the program. 

Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Stack operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY