he question #1 should be read as: hasValidPassword method that checks and return true if the password is not the same as username and it does not contains the user id    Question #2 should accept only 3 parameters instead of 4. But it will have the 4th parameter for output. 3 input parameters + 1 output parameter + integer return code. IN C++ • All data members must be declared as “private” • No global variable is allowed to be declared and used • Methods within the class and the requested functions cannot have “cin” or “cout” but it should make use of parameters and return value instead. • “cin” and “cout” should be done in main() or any testing functions • Make sure that you clearly show how the C++ class, its methods and all the functions are being called at least twice and print out its return value and its results properly.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question

 

The question #1 should be read as:

hasValidPassword method that checks and return true if the password is not the same as username and it does not contains the user id 

 

Question #2 should accept only 3 parameters instead of 4. But it will have the 4th parameter for output. 3 input parameters + 1 output parameter + integer return code.

IN C++

• All data members must be declared as “private”

• No global variable is allowed to be declared and used

• Methods within the class and the requested functions cannot have “cin” or

“cout” but it should make use of parameters and return value instead.

• “cin” and “cout” should be done in main() or any testing functions

• Make sure that you clearly show how the C++ class, its methods and all

the functions are being called at least twice and print out its return value

and its results properly.

midterm_cpp_spr2021.pdf
C . All Data Members Must Be Decl X
Search Google or type a URL
midterm_cpp_spr2021.pdf
2 / 3
80%
+
-
2. Define a new "findPasswordlfUnique" function that accepts 4 parameters:
o An array of “User" object pointers
o Array's length
Search username
It will return an integer number:
O for not found
1 found but there are other User objects with the same username
2 found and its username is unique in that given array
In addition, it will also return the associated password for that user if it is
found and unique.
Show how this function is being called and return proper information.
3. Define a new “changePassword" function that accepts 3 parameters:
o A vector of User object pointers
User ID of the account to be changed
New password
It will return true if it can find that User object with the same user ID and
change the password for that User and false otherwise.
Show how this function is being called and returning proper information.
You can assume that the user ID is unique in the given vector object.
4. Write a function named “HasDashDashOnBothEnds" that accepts 2
parameters of the same as command line arguments (argc and argv). It
will return true if one of the command line arguments that has “-" on both
the beginning and ending and false otherwise.
Requirement: This function should not use cin, cout, string class or string
functions such as strlen, either. It should only use pointers.
11:26 PM
Type here to search
2/16/2021
...
+
II
Transcribed Image Text:midterm_cpp_spr2021.pdf C . All Data Members Must Be Decl X Search Google or type a URL midterm_cpp_spr2021.pdf 2 / 3 80% + - 2. Define a new "findPasswordlfUnique" function that accepts 4 parameters: o An array of “User" object pointers o Array's length Search username It will return an integer number: O for not found 1 found but there are other User objects with the same username 2 found and its username is unique in that given array In addition, it will also return the associated password for that user if it is found and unique. Show how this function is being called and return proper information. 3. Define a new “changePassword" function that accepts 3 parameters: o A vector of User object pointers User ID of the account to be changed New password It will return true if it can find that User object with the same user ID and change the password for that User and false otherwise. Show how this function is being called and returning proper information. You can assume that the user ID is unique in the given vector object. 4. Write a function named “HasDashDashOnBothEnds" that accepts 2 parameters of the same as command line arguments (argc and argv). It will return true if one of the command line arguments that has “-" on both the beginning and ending and false otherwise. Requirement: This function should not use cin, cout, string class or string functions such as strlen, either. It should only use pointers. 11:26 PM Type here to search 2/16/2021 ... + II
midterm_cpp_spr2021.pdf
C . All Data Members Must Be Decl X
Search Google or type a URL
midterm_cpp_spr2021.pdf
1 / 3
90%
+
1. Define a new “User" class that contains a username (string), a password
(string) and user id number (integer). For example, a User can have
o "john", "secret", and 12345
It should have at least the following methods:
o toString method must return all the user information as a string in
the following format:
NAME(user-name) PASSWORD(password) ID(user-id) such as
NAME(john) PASSWORD(secret) ID(12345)
hasValidPassword method that checks and return true if the
password is not the same as username or contains the user id.
o isDuplicate that compares two User objects and return true if they
both have the same user name and password and false otherwise.
Important notes:
o You can add as many other methods as you need. But this class
should not provide the default constructor.
Show how this class being used to create User objects and how these
methods are being called and return proper values.
- 1 -
11:26 PM
Type here to search
2/16/2021
...
+
II
Transcribed Image Text:midterm_cpp_spr2021.pdf C . All Data Members Must Be Decl X Search Google or type a URL midterm_cpp_spr2021.pdf 1 / 3 90% + 1. Define a new “User" class that contains a username (string), a password (string) and user id number (integer). For example, a User can have o "john", "secret", and 12345 It should have at least the following methods: o toString method must return all the user information as a string in the following format: NAME(user-name) PASSWORD(password) ID(user-id) such as NAME(john) PASSWORD(secret) ID(12345) hasValidPassword method that checks and return true if the password is not the same as username or contains the user id. o isDuplicate that compares two User objects and return true if they both have the same user name and password and false otherwise. Important notes: o You can add as many other methods as you need. But this class should not provide the default constructor. Show how this class being used to create User objects and how these methods are being called and return proper values. - 1 - 11:26 PM Type here to search 2/16/2021 ... + II
Expert Solution
Step 1

Actually, given information:


o An array of “Degree” object pointers (not objects)
o Array’s length
o Search year
o Search subject


It will return a vector of Degree object pointers containing only pointers to the matched Degree objects in the given array.
It will return an empty vector if there is no match found.
Show how this function is being called and returning proper values.

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr