UESTION PROVIDED IN ATTACH IMAGE KINDLY SEE. PROVIDE OUTPUT AS IT IS SHOWN IN QUESTION. AND BELOW TEMPLATES PROVIDED CHECK THIS BEFORE MAKING SOLUTION ( main.cpp , user.cpp ) ----------------- TEMPLATES BELOW FOR SOLUTION -----------------------

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

QUESTION PROVIDED IN ATTACH IMAGE KINDLY SEE. PROVIDE OUTPUT AS IT IS SHOWN IN QUESTION.

 

AND BELOW TEMPLATES PROVIDED CHECK THIS BEFORE MAKING SOLUTION ( main.cpp , user.cpp )

 

----------------- TEMPLATES BELOW FOR SOLUTION -----------------------

user.cpp template

#include <iostream>
#include<string.h>
using namespace std;
class User{
private:
string name;
string userName;
string password;
public:
void setName(string n)
{
name=n;
}
void setUserName(string un)
{
userName=un;
}
void setPassword(string p)
{
password=p;
}
string getName()
{


//Fill your code


}
string getUserName()
{


//Fill your code


}
string getPassword()
{


//Fill your code


}

User * getUserDetails(){
User *user = new User[5];
user[0].setName("Abi");
user[0].setUserName("Abinaya");
user[0].setPassword("abi123");
user[1].setName("Arun");
user[1].setUserName("Arunsoorya");
user[1].setPassword("arun456");
user[2].setName("Sbi");
user[2].setUserName("Sbiharan");
user[2].setPassword("sbi789");
user[3].setName("Sidhu");
user[3].setUserName("Siddarth");
user[3].setPassword("sid123");
user[4].setName("Vivi");
user[4].setUserName("Viveka");
user[4].setPassword("vivi456");
return user;
}

void display(string s) {


//Fill your code


}

};

 

main.cpp template

#include<iostream>
#include<string.h>
#include "User.cpp"
using namespace std;

string validate(string uname,string pword){
User u1;
string name = "";
User *u = u1.getUserDetails();

//Fill your code

return name;

}

int main() {

//Fill your code

return 0;
}

It's Chandler Bing's birthday and his good friend Joey wants to throw a party for all the near and dear
ones. As Chandler Bing is a big star, so Joey knows the fact that the fans of the former would definitely
try to gate crash the party.
So he decides to keep a security system at the door that will ask the guest for their name and then
username and password which Joey himself assigned for each guest. If the credentials match then a
custom welcome message will be displayed and the gate will open, otherwise, it will display the message
"Invalid username/password".
Write a C++ program to validate the password using the friend function and use a public display
function to print the final output.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class
names, member variable names, and function names should be the same as specified in the problem
statement.
The class User has the following private member variables
Variable
Data type
string
string
string
name
userName
password
Declare the following function to validate the user which will be able to access the private data
members of the User class in the main method.
Member Function
Description
Declare validate() as friend function.
This function is used to validate the username and password given by the
user. If the username and password match it returns the user name or else it
string validate(string userName, string password)
returns "No".
Declare the following member function inside the User class.
Member Function
User* getUserDetails()
Description
This method returns the already hardcoded name,
userName, and password. The method is already given as a
part of template
This function displays "Hii.userName ! Welcome to the
event!!! " if the validation is successful or else it displays
"Invalid username/password"
void display (string s)
In the main method, obtain input from the user in the console and create a new User object and assign
the values to the object's members using setters. Create a function validate() to verify the user
credentials and display the output using a public display function.
Input and Output format:
Input consists of three strings
First line of input corresponds to name
Second line of input corresponds to username
Third line of input corresponds to the password
Refer sample input and output for formatting specifications
[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output 1:
Enter name:
vivi
Enter the username:
viveka
Enter the password:
vivi456
Hii.vivi ! Welcome to the event!!!
Sample Input and Output 2:
Enter name:
Suresh
Enter the username:
Sureshkumar
Enter the password:
suresh345
Invalid username/password
Transcribed Image Text:It's Chandler Bing's birthday and his good friend Joey wants to throw a party for all the near and dear ones. As Chandler Bing is a big star, so Joey knows the fact that the fans of the former would definitely try to gate crash the party. So he decides to keep a security system at the door that will ask the guest for their name and then username and password which Joey himself assigned for each guest. If the credentials match then a custom welcome message will be displayed and the gate will open, otherwise, it will display the message "Invalid username/password". Write a C++ program to validate the password using the friend function and use a public display function to print the final output. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. The class User has the following private member variables Variable Data type string string string name userName password Declare the following function to validate the user which will be able to access the private data members of the User class in the main method. Member Function Description Declare validate() as friend function. This function is used to validate the username and password given by the user. If the username and password match it returns the user name or else it string validate(string userName, string password) returns "No". Declare the following member function inside the User class. Member Function User* getUserDetails() Description This method returns the already hardcoded name, userName, and password. The method is already given as a part of template This function displays "Hii.userName ! Welcome to the event!!! " if the validation is successful or else it displays "Invalid username/password" void display (string s) In the main method, obtain input from the user in the console and create a new User object and assign the values to the object's members using setters. Create a function validate() to verify the user credentials and display the output using a public display function. Input and Output format: Input consists of three strings First line of input corresponds to name Second line of input corresponds to username Third line of input corresponds to the password Refer sample input and output for formatting specifications [All text in bold corresponds to input and the rest corresponds to output] Sample Input and Output 1: Enter name: vivi Enter the username: viveka Enter the password: vivi456 Hii.vivi ! Welcome to the event!!! Sample Input and Output 2: Enter name: Suresh Enter the username: Sureshkumar Enter the password: suresh345 Invalid username/password
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Database connectivity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education