Question

In: Computer Science

C++: Write a student class for the library, which have the following: Username, password, Maximum number...

C++: Write a student class for the library, which have the following:

Username, password, Maximum number of copies that a student is allowed to keep(less than 5), maximum borrow periods(less than 30 days per book), list of copy(array)

cpp and h

Solutions

Expert Solution

//Here is the class containing for the stude nt in c++

class student{

     private:

            string username;

            string password;

            int no_of_copies;

            string copies[5]; //array for storing copies name borrowed by student

     public :

           student

           {

                   no_of_copies=1;

           }

           int checkUsernamePassword(string username,string password)

          {

                       if((this.username==username)&&(this.password==password))

                       {

                                    return 1;

                        }

                       else

                         {

                                   cout<<"Please Check username and password"<<endl;

                         }

          }

            void   IssueBook(string bookName)

           {

                          if(no_of_copies<5)

                           {

                                       no_of_copies;

                                      copies[no_of_copies]=bookName;

                           }

                           else

                            {

                                       cout<<"Your limit exceed please return any book "<<endl;

                             }

           }

           void returnBook(string bookName)

           {

                  for(int i=1;i<=no_of_copies;i++)

                  {

                                int j=0;

                                if(copies[i]==bookName)

                                {

                                       cout<<"Book returned"<<endl;

                                       j=i;

                                       while(j<=no_of_copies)

                                       {

                                                 copies[j]=copies[j+1];

                                                  j++;

                                        }

}                         

                  }

           }

           

};


Related Solutions

Write C++ code that prompts the user for a username and password (strings), and it calls...
Write C++ code that prompts the user for a username and password (strings), and it calls the login() function with the username and password as arguments. You may assume that username and password have been declared elsewhere. Your code should print error messages if login() generates an exception: LoginException: "Username not found or password incorrect" ServerException: "The login server is busy and you cannot log in" AccessException: "Your account is forbidden from logging into this server" Any other exception: "Unknown...
Write C++ code that prompts the user for a username and password (strings), and it calls...
Write C++ code that prompts the user for a username and password (strings), and it calls the login() function with the username and password as arguments. You may assume that username and password have been declared elsewhere. Use virtual functions, pure virtual functions, templates, and exceptions wherever possible. Please explain the code. Your code should print error messages if login() generates an exception: LoginException: "Username not found or password incorrect" ServerException: "The login server is busy and you cannot log...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName,...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName, LastName, Year) Takes (Username, Department, Number, Term, Grade) [clarification] In Student, Year is an integer. A student can be a 2nd year student. In that case, Year value would be 2. For the Takes relation: ·         Grade is NA for current semester students ·         Username is foreign key to Student ·         (Department, Number, Term) is foreign key to Class a)       Write an SQL query that returns the Term...
-Write in C++ -Use Char library functions Write a function that accepts a string representing password...
-Write in C++ -Use Char library functions Write a function that accepts a string representing password and determines whether the string is a valid password. A valid password as the following properties: 1. At least 8 characters long 2. Has at least one upper case letter 3. Has at least one lower case letter 4. Has at least one digit 5. Has at least on special character
Write a C program for a library automation which gets the ISBN number, name, author and...
Write a C program for a library automation which gets the ISBN number, name, author and publication year of the books in the library. The status will be filled by the program as follows: if publication year before 1985 the status is reference else status is available. The information about the books should be stored inside a linked list. The program should have a menu and the user inserts, displays, and deletes the elements from the menu by selecting options....
Question3: Consider you have the following data for some user accounts: [6 marks] Username Password User1...
Question3: Consider you have the following data for some user accounts: [6 marks] Username Password User1 101010 User2 112121 User3 211211 User4 312132 1. Write a function called validate which takes 2 arguments: a dictionary, a username, and a password. The function should do the following: [3 marks] Find the given username in the dictionary and compare the given password with the one that belongs to that username in the dictionary. Return true if password is correct and false if...
The following times between keystrokes were recorded when a user typed the username and password: .23,...
The following times between keystrokes were recorded when a user typed the username and password: .23, .21, .27, .35, .33, .31, .34, .28, .20, .35, .31, .16, .16, .29, .39, .40, .35, .26 seconds. Let’s construct a 99% confidence interval for the mean time between keystrokes assuming Normal distribution of these times.
Using C++ Write a program to ask user to enter a password and validity the password....
Using C++ Write a program to ask user to enter a password and validity the password. The password should be 8 – 20 characters long (8 is included and 20 is included), it should contain at least one uppercase letter and one lower case letter. The password should contain at least one digit, and at least one symbol other than alphabets or numbers. Most importantly, the password may not contain any white space. Functions: You will need at least the...
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
Write a class encapsulating the concept of a Student, assuming that the Student has the following...
Write a class encapsulating the concept of a Student, assuming that the Student has the following attributes: the name of the student, the average of the student, and the student’s GPA. Include a default constructor, an overloaded constructor, the accessors and mutators, and methods toString() and equals(). Also include a method returning the letter grade base on the following range for the average: Average Range Letter Grade 90-100 A 85-89   B+ 80-84 B 75-79 C+ 70-74 C 65-69 D+ 60-64...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT