Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c++ You should have separste files for class definition and implementation: User.h and User.cpp Create a class User, with separate interface and implementation, comprised

In c++

image text in transcribed

You should have separste files for class definition and implementation: User.h and User.cpp Create a class User, with separate interface and implementation, comprised of the following attributes Data members (private) string: username int array: ratings int numRatings Number of elements should be size Number of books in the database Int: size Member functions (public) Default constructor The capacity of the ratings array (200). Constant Sets username to an empty string, numRatings to0 size to 200, and all the elements of ratings array to the value -1 Parameterized constructor Takes a string, an array of integers, and one integer for initializing username, ratings, and numRatings, respectively. Make sure the value passed into the constructor for numRatings does not exceed the value of the data member size Returns username getUsername () setUsername (string) (void) Assigns username the value of the input string getRatingAt (int) Parameter: int index. Returns the rating stored at the specified index. If index is larger than the size of the ratings array, returns -1 setRatingAt (int,int) Parameters: int index, int value. Sets the rating to value at the specified index, if index is within the bounds of the Returns a boolean, true if the rating is successfully updated and false otherwise array and value is between 0 and 5 Returns numRatings getNumRatings () setNumRatings (int) (void) Assigns numRatings the value of the input int getSize () Returns size You should have separste files for class definition and implementation: User.h and User.cpp Create a class User, with separate interface and implementation, comprised of the following attributes Data members (private) string: username int array: ratings int numRatings Number of elements should be size Number of books in the database Int: size Member functions (public) Default constructor The capacity of the ratings array (200). Constant Sets username to an empty string, numRatings to0 size to 200, and all the elements of ratings array to the value -1 Parameterized constructor Takes a string, an array of integers, and one integer for initializing username, ratings, and numRatings, respectively. Make sure the value passed into the constructor for numRatings does not exceed the value of the data member size Returns username getUsername () setUsername (string) (void) Assigns username the value of the input string getRatingAt (int) Parameter: int index. Returns the rating stored at the specified index. If index is larger than the size of the ratings array, returns -1 setRatingAt (int,int) Parameters: int index, int value. Sets the rating to value at the specified index, if index is within the bounds of the Returns a boolean, true if the rating is successfully updated and false otherwise array and value is between 0 and 5 Returns numRatings getNumRatings () setNumRatings (int) (void) Assigns numRatings the value of the input int getSize () Returns size

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

What are S.M.A.R.T. goals?

Answered: 1 week ago