Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data steucture assignment code in c++ follow the instructions in the pictures please write full program including the main a Description In this assignment, you

Data steucture assignment
code in c++
follow the instructions in the pictures
please write full program including the main
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
a Description In this assignment, you are going to build a subprogram that maintain a unoredered list of user accounts. Each node of the list will store the information of one user account. You need to implement the following classes User AccountType. User AccountNode and User AccountListType. Their specifications are shown in the UMLs (Figures 1, 2 and 3). User AccountType is the class that define the attributes of a user account including the user ID, the user password, First Name, Last Name. It is very important to implement a default constructor beside the parametrized constructor of User AccountType.otherwise you will get a syntax error when you implement the class User AccountNode that has a composition of the class User AccountType. (Alternatively, we can create parameterized contractor of User.centNode that passes the argument to the parameter constructoe of User AccountNode. but you don't have to implement that way User AccountNode is the type that you will see to create nodes and them to a list (object) of the class User AccountListType. Each node you will create has two member elements: 1) an object of the type User AccountType. 2) a link (pointer of the type User AccountNode) that points to the next node in the list. User AccountListType is used to create an unordered list of user accounts. The list a collection of nodes of the type User AccountNode. Each user account in the list has user id, these user ids should be unique. Which means that it is not acceptable to have two nodes in the list with the same user id. In other words, the user id is a key. Figure 4 is a sample user accounts list of type in User AccountListType. class User Account Type 33 pes) #userld: string wer ID.e. ahmadali #encrypted password: string # FirtsName : string #LastName : string User AccountType) mi po default construct that all of the member alles. 10 *** +User Account Type (string, string, string, string) 30 Set the values of the parameters to the member variable, you need to make sure that the passwoed is a valid passw, therwise it to if it is a valid password, it should be encrypted first and then being set to the member variable encrypted posword setuserId(string): void setFirstName(string): void setLastName(string): void setPassword(string): void you need to make sure that the password is a valid password, otherwise set it to if it is a valid passwont, it should be encrypted first and then being it to the member variable enesytet password getUserId():string) return the world isCompleteuserAccount():bool Ipt) return true if cache member values are set to some value other than if it least one of them is the return false encryptPassword (string): (12 pt this function evenes the original pacewond and return it atter encryption The encryption procedure is described below printUser Info():void wat print the values of all member vabies isvalidPassword(string pw): boole return true if the passed a valid or falso otherwise. Valid pusswind citests of -s characters, one of them is a digitamatute is a symbol from the sett..) and the testate letters +isCompleteUser Account():bool/retur true if each member values are set to some value (other than **), if at least one of them is then retum false. tencryptPassword(string): //this function receives the original password and return it +after encryption. The encryption procedure is described below. +printUserInfo():void / print the values of all member variables +isValidPassword(string pw): bool/return true if the password is valid or false otherwise. Valid password consists of 6-8 characters, one of them is a digit and one is a symbol from the set (",, S), and the restare letters Figure 1: UML of the class User AccountType class User AccountNode/X pts) + user_account: User AccountType // object of type Car Type + link: User AccountNode. Figure 2: UML of the class user AccountNode class User AccountListType first: User AccountNode* V/Pointer to the first node of the list. last: User AccountNode W/Pointer to the last node of the list. counter: int WA counter to hold the number of nodes of the list. +User AccountListType(): //1pts) default constructor Initializes the list to an empty state +-User AccountListType (): (Ipts) destructor: //Deletes all the nodes from the list. +destroyList():void // (1 pts) Delete all the nodes from the list. +print() const: void (3 pts) Prints the contents of the User Account list +bool IsuserIdExist(string ud); // pts) return true if the list has user account with the user id ud +void insertUser Account(const user AccountType newItem); // pts) If all information userid, FirstName, LastName, encrypted_password of the parameter newItem (an object of of type user accountType) are set to non-empty strings (I mean none of them is set to **), then insert the object to the end of the list if no user exist in the list with the same use id. Hint: you need to use the functions isCompleteUser Account and Isuseridexist +void deleteUser Account(string ud); // pts) delete from the list the user account node in which userId equals the parameter ud +void printInfo_of_userId(string user_id); // pts) //print the information of the user AccountNode in the list that for which the value of user Id equals the parameter ud, or an error message if it is not found. Figure 3: UML of the class User AccountListType Figure 1: UML of the class User Account Type class User AccountNode // 1 pts) + user_account: UserAccountType object of type User AccountType + link: User AccountNode Figure 2: UML of the class user AccountNode class User AccountListType (20) first: User AccountNode. Pointer to the first node of the list. last: User AccountNode Pointer to the last node of the list counter: int A corinter to hold the number of nodes of the list. +UserAccountListType(): ici pts) default constructor: Initializes the list to an empty state +-User AccountListType (): // destructor: //Deletes all the nodes from the list. #destroyList():void // (1 pts) Delete all the nodes from the list. +print() const: void (3 pts) Prints the contents of the book User Account list +bool IsuserIdExist(string ud); 4 pts) return true if the list has user account with the user id ud +void insertUser Account(const userAccounttype newItem); (4 pts) If all information userid, FirstName, LastName, encrypted_password of the parameter newitem (an object of of type user AccountType) are set to non-empty strings (I mean none of them is set to **), then insert the object to the end of the list if no user exist in the list with the same use id. Hint: you need to use the functions isComplete serccount and IsUserIdExist +void deleteUser Account(string ud); //(Apts) delete from the list the user account node in which userId equals the parameter ud +void printInfo_of_userId(string user_id); (4pts//print the information of the userAccountNode in the list that for which the value of userId equals the parameter ud Figure 3: UML of the class User AccountListType Almal Ali Tig Halus Hata Moitammal 1df Aler_1909 Ah Khalid el first last Figure 4. A sample user account list Password Encryption You are NOT allowed to use string operations Or array declaration in the encryption process. You are asked to declare lists stacks and Queues of type char from the STL to encrypt the password to get full score. Encryption Algorithm Step 1: (2 points) In this step the password characters will be inserted into list object to be ready for the coming encryption stages. (objects to use only list) Step 2: (2 points) In this step, the first and last characters of the password (within the list) will be reversed. (eg H21*10 0711H) (objects to use only list) Step 3: (5 Points) In this step, the ASCII value of the characters will be changed and the new characters (after changing the ASCII) will be in original order in the list. The new ASCII value for each character will be calculated by adding to the current ASCII value the least significant digit from the ASCII of the next character. (e.g. After step 2, the password is: Dell with ASCII values: 0: 111 7:55, 1: 108 *:42 1: 108. H: 72 The new ASCII values will be t: 111.5, ?: 55, 1012 2:48 n: 10+2, H: 72 The password will be: t?nnel Note: The ASCII for the last character will not be changed because there is no character next to the last one. (objects to use list and stack or list and queue or both) give explanation for your choice. Step 4: (4 points) Finally, in this step, the characters in even positions will be reversed and you keep the characters in the odd positions in their original order. (e.g. After step 3, the password is : thanh so after applying step 4 the password will be : ninath (objects to use list and stack Ok list and queue or both) glve explanation for your choice. Important notes: No templates are used. Add the time complexity of each function as a comment before the function header Implement the functions outside the classes Implement the classes and their functions as specified in the UML. (by the green comment). You must write a driver program (main function) to test the functions you implemented. You are responsible for designing test code (main function) that helps us to see if your functions are implemented properly. In the test code, you define an object of the class User AccountListType and call the functions. You need to place your test code inside a file called main.cpp. During grading, we are also going to use our own test code to check if your code is written properly or not. A sample test run is presented in figure 5. Think of the following seenarios when you test your code

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions