SlideShare a Scribd company logo
1 of 3
Download to read offline
You would like to verify the credentials of a user for your system.
Listed next is a class names Security, which authenticates a user and password.
(Note that this example is really not secure. Typically, passwords would be
encrypted or stored in a database.)
class Security
{
public:
static int validate(string username, string password);
};
int Security::validate(string username, string password)
{
if ((username == "abbott") && (password == "monday"))return 1;
if ((username == "costello") && (password == "tuesday"))return 2;
return 0;
}
Break this class into two files, a file with the header Security.h and a file with the
implementation
Security.cpp
Next, create two more classes that use Security class by including the header file. The first class
should
be named Administrator and contain a function named Login that returns true if a given
username and
password have administrator clearance. The second class should be named User and contain a
function
named Login that returns true if a given username and password have either user or
administrator
clearance
Both the User and Administrator classes should be split into separate files for the header and
implementation.
Finally, write a main function that invokes the login function for both the User and
Administrator classes
to test if they work property. The main function should be in a separate file. Be sure to use
#ifndef
directive to ensure that no header file is included more than once.
Here is what i have so far:
security:
#ifndef SECURITY_H_
#define SECURITY_H_
#include
using namespace std;
class Security {
public:
static int validate(string username, string password);
};
#endif /* SECURITY_H_ */
administrator:
#ifndef SECURITY_H_
#define SECURITY_H_
#include
using namespace std;
class Security {
public:
static int validate(string username, string password);
};
#endif /* SECURITY_H_ */
user:
#ifndef USER_H_
#define USER_H_
#include
using namespace std;
class User {
public:
static bool Login(string username, string password);
};
#endif /* USER_H_ */
security.cpp:
#include "Security.h"
int Security::validate(string username, string password) {
if (username == "abbott" && password == "monday") return 1;
if (username == "abbott" && password == "monday") return 2;
system("pause")
; return 0;
}
user.cpp:
#include "User.h"
bool User::Login(string username, string password) {
return username == "user" && password == "user";
}
administrator.cpp:
#include "Administrator.h"
bool Administrator::Login(string username, string password) {
return username == "admin" && password == "admin";
}
main.cpp:
#include
#include "Security.h"
#include "User.h"
#include "Administrator.h"
int main() {
system("pause")
; return 0;
}
i cannot test it. i think there needs to be something in my main.cpp file but it will not run the
program as instructed in the above instructiojns

More Related Content

Similar to You would like to verify the credentials of a user for your system..pdf

TYPO3 6.2 for extension developer
TYPO3 6.2 for extension developerTYPO3 6.2 for extension developer
TYPO3 6.2 for extension developerNicole Cordes
 
Things to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratchThings to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratchElsner Technologies Pvt Ltd
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective cSunny Shaikh
 
Functions and Modules.pptx
Functions and Modules.pptxFunctions and Modules.pptx
Functions and Modules.pptxAshwini Raut
 
Deep Dive into Kubernetes - Part 2
Deep Dive into Kubernetes - Part 2Deep Dive into Kubernetes - Part 2
Deep Dive into Kubernetes - Part 2Imesh Gunaratne
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Lesson07-UsernamePasswordAuthenticationFilter.pdf
Lesson07-UsernamePasswordAuthenticationFilter.pdfLesson07-UsernamePasswordAuthenticationFilter.pdf
Lesson07-UsernamePasswordAuthenticationFilter.pdfScott Anderson
 
Implementing application security using the .net framework
Implementing application security using the .net frameworkImplementing application security using the .net framework
Implementing application security using the .net frameworkLalit Kale
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testabilityJohn Sundell
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgnitermirahman
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docxajoy21
 
WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018Abul Khayer
 
Struts database access
Struts database accessStruts database access
Struts database accessAbass Ndiaye
 
7 unixsecurity
7 unixsecurity7 unixsecurity
7 unixsecurityricharddxd
 
JavaEE Security
JavaEE SecurityJavaEE Security
JavaEE SecurityAlex Kim
 

Similar to You would like to verify the credentials of a user for your system..pdf (20)

TYPO3 6.2 for extension developer
TYPO3 6.2 for extension developerTYPO3 6.2 for extension developer
TYPO3 6.2 for extension developer
 
Things to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratchThings to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratch
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
 
Functions and Modules.pptx
Functions and Modules.pptxFunctions and Modules.pptx
Functions and Modules.pptx
 
Apache Web Server Setup 4
Apache Web Server Setup 4Apache Web Server Setup 4
Apache Web Server Setup 4
 
Deep Dive into Kubernetes - Part 2
Deep Dive into Kubernetes - Part 2Deep Dive into Kubernetes - Part 2
Deep Dive into Kubernetes - Part 2
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
sun solaris
sun solarissun solaris
sun solaris
 
ExtraFileIO.pptx
ExtraFileIO.pptxExtraFileIO.pptx
ExtraFileIO.pptx
 
Lesson07-UsernamePasswordAuthenticationFilter.pdf
Lesson07-UsernamePasswordAuthenticationFilter.pdfLesson07-UsernamePasswordAuthenticationFilter.pdf
Lesson07-UsernamePasswordAuthenticationFilter.pdf
 
Inheritance
Inheritance Inheritance
Inheritance
 
Implementing application security using the .net framework
Implementing application security using the .net frameworkImplementing application security using the .net framework
Implementing application security using the .net framework
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testability
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
 
WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018WordPress Security Fundamentals - WordCamp Biratnagar 2018
WordPress Security Fundamentals - WordCamp Biratnagar 2018
 
Struts database access
Struts database accessStruts database access
Struts database access
 
7 unixsecurity
7 unixsecurity7 unixsecurity
7 unixsecurity
 
JavaEE Security
JavaEE SecurityJavaEE Security
JavaEE Security
 

More from sagar753267

�Qu� evento marca el comienzo de una supernova tipo II el inici.pdf
�Qu� evento marca el comienzo de una supernova tipo II el inici.pdf�Qu� evento marca el comienzo de una supernova tipo II el inici.pdf
�Qu� evento marca el comienzo de una supernova tipo II el inici.pdfsagar753267
 
�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdf
�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdf�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdf
�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdfsagar753267
 
�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdf
�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdf�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdf
�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdfsagar753267
 
�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdf
�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdf�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdf
�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdfsagar753267
 
�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdf
�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdf�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdf
�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdfsagar753267
 
�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdf
�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdf�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdf
�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdfsagar753267
 
�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdf
�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdf�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdf
�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdfsagar753267
 
�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdf
�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdf�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdf
�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdfsagar753267
 
�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdf
�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdf�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdf
�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdfsagar753267
 
�Es la perspectiva del gran volumen de clientes potenciales de China.pdf
�Es la perspectiva del gran volumen de clientes potenciales de China.pdf�Es la perspectiva del gran volumen de clientes potenciales de China.pdf
�Es la perspectiva del gran volumen de clientes potenciales de China.pdfsagar753267
 
�Discutir un evento importante en la historia laboral que haya tenid.pdf
�Discutir un evento importante en la historia laboral que haya tenid.pdf�Discutir un evento importante en la historia laboral que haya tenid.pdf
�Discutir un evento importante en la historia laboral que haya tenid.pdfsagar753267
 
�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdf
�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdf�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdf
�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdfsagar753267
 
�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdf
�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdf�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdf
�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdfsagar753267
 
�El siguiente estado es verdadero o falso Al comienzo de la ind.pdf
�El siguiente estado es verdadero o falso Al comienzo de la ind.pdf�El siguiente estado es verdadero o falso Al comienzo de la ind.pdf
�El siguiente estado es verdadero o falso Al comienzo de la ind.pdfsagar753267
 
�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdf
�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdf�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdf
�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdfsagar753267
 
�C�mo presenta la competencia central de Disney una ventaja competit.pdf
�C�mo presenta la competencia central de Disney una ventaja competit.pdf�C�mo presenta la competencia central de Disney una ventaja competit.pdf
�C�mo presenta la competencia central de Disney una ventaja competit.pdfsagar753267
 
�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdf
�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdf�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdf
�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdfsagar753267
 
�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdf
�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdf�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdf
�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdfsagar753267
 
�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdf
�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdf�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdf
�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdfsagar753267
 
�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdf
�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdf�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdf
�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdfsagar753267
 

More from sagar753267 (20)

�Qu� evento marca el comienzo de una supernova tipo II el inici.pdf
�Qu� evento marca el comienzo de una supernova tipo II el inici.pdf�Qu� evento marca el comienzo de una supernova tipo II el inici.pdf
�Qu� evento marca el comienzo de una supernova tipo II el inici.pdf
 
�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdf
�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdf�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdf
�Qu� 2 afirmaciones son verdaderas para Proyectos en QuickBooks Onli.pdf
 
�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdf
�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdf�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdf
�Qu� afirmaci�n no respalda la idea de que el gobierno del condado n.pdf
 
�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdf
�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdf�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdf
�Deber�an suprimirse o rechazarse los puntos de vista controvertidos.pdf
 
�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdf
�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdf�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdf
�Por qu� puede ser dif�cil identificar las consecuencias de cada alt.pdf
 
�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdf
�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdf�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdf
�Por qu� Disney ha tenido �xito durante tanto tiempo �Qu� hizo Mi.pdf
 
�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdf
�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdf�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdf
�Hay algunos conflictos que son inmanejables �Por qu� o por qu� no �.pdf
 
�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdf
�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdf�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdf
�Las iniciativas de vida laboral que incluyen permisos de ausencia, .pdf
 
�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdf
�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdf�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdf
�Es un clon gen�ticamente id�ntico a sus padres Grupo de opciones.pdf
 
�Es la perspectiva del gran volumen de clientes potenciales de China.pdf
�Es la perspectiva del gran volumen de clientes potenciales de China.pdf�Es la perspectiva del gran volumen de clientes potenciales de China.pdf
�Es la perspectiva del gran volumen de clientes potenciales de China.pdf
 
�Discutir un evento importante en la historia laboral que haya tenid.pdf
�Discutir un evento importante en la historia laboral que haya tenid.pdf�Discutir un evento importante en la historia laboral que haya tenid.pdf
�Discutir un evento importante en la historia laboral que haya tenid.pdf
 
�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdf
�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdf�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdf
�Est�s de acuerdo con la filosof�a de Indra Nooyi de que el desempe.pdf
 
�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdf
�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdf�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdf
�Existe alguna diferencia entre la probabilidad te�rica de que un ni.pdf
 
�El siguiente estado es verdadero o falso Al comienzo de la ind.pdf
�El siguiente estado es verdadero o falso Al comienzo de la ind.pdf�El siguiente estado es verdadero o falso Al comienzo de la ind.pdf
�El siguiente estado es verdadero o falso Al comienzo de la ind.pdf
 
�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdf
�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdf�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdf
�El �nico anillo para gobernarlos a todos La diversidad de enfoque.pdf
 
�C�mo presenta la competencia central de Disney una ventaja competit.pdf
�C�mo presenta la competencia central de Disney una ventaja competit.pdf�C�mo presenta la competencia central de Disney una ventaja competit.pdf
�C�mo presenta la competencia central de Disney una ventaja competit.pdf
 
�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdf
�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdf�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdf
�C�mo pueden las organizaciones garantizar mensajes consistentes en .pdf
 
�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdf
�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdf�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdf
�C�mo se llama la diferencia entre el valor de la hip�tesis nula y l.pdf
 
�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdf
�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdf�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdf
�Cu�nto tiempo atr�s en la historia tenemos que ir para comprender l.pdf
 
�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdf
�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdf�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdf
�Cu�les de las siguientes condiciones se requieren para que ocurra l.pdf
 

Recently uploaded

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

You would like to verify the credentials of a user for your system..pdf

  • 1. You would like to verify the credentials of a user for your system. Listed next is a class names Security, which authenticates a user and password. (Note that this example is really not secure. Typically, passwords would be encrypted or stored in a database.) class Security { public: static int validate(string username, string password); }; int Security::validate(string username, string password) { if ((username == "abbott") && (password == "monday"))return 1; if ((username == "costello") && (password == "tuesday"))return 2; return 0; } Break this class into two files, a file with the header Security.h and a file with the implementation Security.cpp Next, create two more classes that use Security class by including the header file. The first class should be named Administrator and contain a function named Login that returns true if a given username and password have administrator clearance. The second class should be named User and contain a function named Login that returns true if a given username and password have either user or administrator clearance Both the User and Administrator classes should be split into separate files for the header and implementation. Finally, write a main function that invokes the login function for both the User and Administrator classes to test if they work property. The main function should be in a separate file. Be sure to use #ifndef directive to ensure that no header file is included more than once. Here is what i have so far:
  • 2. security: #ifndef SECURITY_H_ #define SECURITY_H_ #include using namespace std; class Security { public: static int validate(string username, string password); }; #endif /* SECURITY_H_ */ administrator: #ifndef SECURITY_H_ #define SECURITY_H_ #include using namespace std; class Security { public: static int validate(string username, string password); }; #endif /* SECURITY_H_ */ user: #ifndef USER_H_ #define USER_H_ #include using namespace std; class User { public: static bool Login(string username, string password); }; #endif /* USER_H_ */ security.cpp: #include "Security.h" int Security::validate(string username, string password) { if (username == "abbott" && password == "monday") return 1; if (username == "abbott" && password == "monday") return 2; system("pause")
  • 3. ; return 0; } user.cpp: #include "User.h" bool User::Login(string username, string password) { return username == "user" && password == "user"; } administrator.cpp: #include "Administrator.h" bool Administrator::Login(string username, string password) { return username == "admin" && password == "admin"; } main.cpp: #include #include "Security.h" #include "User.h" #include "Administrator.h" int main() { system("pause") ; return 0; } i cannot test it. i think there needs to be something in my main.cpp file but it will not run the program as instructed in the above instructiojns