Reference no: EM131419021
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.
How do the different roles of system software affect you
: How do the different roles of system software and application software affect you as a business end-user? How do you see this changing in the future?
|
Compensation analysts for an insurance company
: As a compensation analysts for an insurance company in Hartford, Connecticut, define the relevant labor market for insurance claims adjusters and for data entry clerks. Please provide support for your answer.
|
Manage underperforming department of business
: Imagine that you are hired to manage an underperforming department of a business. Upon assessing day to day operations for a period of time, you observe that there appears to be a good deal of confusion in the department. The problems run the gamut f..
|
Case study-downsizing and appraisals at dbart
: Seminar Three Case Study: Downsizing and Appraisals at DBart (Submit to Assignment Link Day Six) Make sure that your solution is grounded in economic reality and is in compliance with Title VII.
|
Develop a program that will perform security authorisation
: 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.
|
Pros and cons of launching lightening bolt
: From a management perspective, what do you see as the pros and cons of launching Lightening Bolt?
|
Article on diversity and promise fulfillment by organization
: After reading the Buttner, Lowe, and Billings-Harris (2010) article on diversity and promise fulfillment by organizations, discuss your thoughts on how organizations, and your organization in particular, can use this information to better understa..
|
What kinds of changes occur when emotional wounds
: Maya Lin said that the Memorial was meant to help people confront their pain. What kinds of changes occur when emotional wounds begin to heal - DISCUSS AND COMPARE Edgar Heap of Birds Most Serene Republic memorial and Wheel to Maya Lin's Vietnam..
|
Seniority versus merit pay
: Compare and contrast seniority (longevity) pay with merit pay. Determine the advantages and disadvantages of each, including specific examples to support your response.
|