You are required to develop a program that will perform


Assignment

You are required to develop a program that will perform security authorisation based on access codes. The access codes are 4 single-digit integer numbers between 0-9. The program should allow a user to enter a code, encrypt the number and compare it to an authorised access code. The program should also allow the user to decrypt an encrypted code.

When your program begins executing, the default authorised access code is 4523 (encrypted form of 1234 - see encryption algorithm below). This code must be stored in a 1-D array called access_code and should not be changed. You should use a different 1-D array to read the code entered by the user.

Your program should be menu-driven and must display a simple menu when run. The menu should include the following options:

1. Enter code
2. Encrypt code and verify if correct (i.e., matches authorised access code)
3. Decrypt code
4. Display the number of times the code was entered (i) Successfully (ii) Incorrectly
5. Exit Program

Note:

• Each menu option must be implemented in a separate function, i.e. modularized.
• All functions must pass parameters using Pass by Reference. Do NOT pass parameters using pass by value.
• All reading and writing to/from arrays must use pointer notation - not subscript notation (i.e. using [ ])

Requirements:

(Each implemented in a separate function):

1. Enter 4 single-digit integers. Perform any necessary validation (errorchecking).
2. Encrypt the code entered. You should use the following algorithm to encrypt the 4 single-digit integers:

Encryption Algorithm:

- Swap the 1st number with the 3rd number.
- Swap the 2nd number with the 4th number.
- Add 1 to each number. - If any number has a value equal to 10, change this value to 0.

3. Compare the encrypted number from step 2 with the access code (4523) stored in the 1-D array called access_code. If the 2 codes match, display a message saying CORRECT CODE. If the 2 codes do not match, display a message saying ERROR CODE.

4. Provide an option to allow a user to decrypt an encrypted code. You should use the following algorithm to decrypt the encrypted code only:

Decryption Algorithm:

- Subtract 1 from each number.
-If any number has a value equal to -1, change this value to 9.
- Swap the 1st number with the 3rd number.
- Swap the 2nd number with the 4th number.

5. Count the number of times a user entered a correct/incorrect code after it is encrypted and compared to the access code in each run of the program.

6. The program should terminate gracefully.

Features to include:

• After each option has finished, your program should return to the main menu and allow the user to select another option.
• The user should only be allowed to encrypt their code (i.e. select option 2) if the code is NOT already encrypted.
• The user should only be allowed to decrypt their code (i.e. select option 3) if the code IS already encrypted.
• Only encrypted codes should be compared with the access-code (option 2).
• Display appropriate error messages to handle any errors.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: You are required to develop a program that will perform
Reference No:- TGS02215639

Expected delivery within 24 Hours