Sale!

COMP248 Assignment 1 Password Encryption

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

Question 1 – Password Encryption (4 pts)
Write a complete program that ask the user prompt a number with 6 digits and output the
encrypted password.
Your program should behave as follow:
1. Display a welcome message.
2. Ask the user for the input number.
3. Use a constant variables to store the value 10 in the program.
4. Display the encrypted number, which is equivalent by
1) Swap the 1st and 6th digits
2) Replace the second digit with the remainder of the second digit divided by 2.
3) Minus 1 to the third digit of your input.
4) Replace the fourth digit with the remainder of the third digit divided by 3.
5) Swap the 4th and 5th digits.
5. Display a farewell message, so that the user knows that the program has terminated
normally.
COMP248/Winter 2021 – Assignment 1 Page 2 of 4
Following are the sample screen shots to illustrate the expected behavior of your program. Assume
a perfect user who will always enter a correct input with 6 digits.
Note: Your program must display the same information and formatted the same.
Figure 1. Sample output of Question#1
Figure 2. Sample output of Question#1
Question 2 – Letter Encryption (8 points)
Write a program that prompts the user for two words (W1 and W2) with 3 characters.
Your program should behave as follow:
1. Display a welcome message.
2. Ask the user for the inputs of two words.
3. Display the lengths of both words.
4. Use a new string to merge two words. The new word should follow:
a. The sequence: 3rd character of W1 + 3rd character of W2 + 1st character of W1 + 1st
character of W2 + 2nd character of W1 + 2nd character of W2, display the new
generated word.
b. Swap the 2nd and 6th characters of the new word.
c. Swap the 1st and 5th characters of the new word.
5. Display the new word.
COMP248/Winter 2021 – Assignment 1 Page 3 of 4
6. Display a farewell message, so that the user knows that the program has terminated
normally.
Restrictions: No looping statements allowed (or needed). This question requires the use of the
functions: length(), substring().
Following are the sample screen shots to illustrate the expected behavior of your program. Your
program should work with any word with 3 characters entered by the user. Assume a perfect user
who will always enter a word with exactly 3 characters.
Note: Your program must display the same information and formatted the same.
Figure 3. Sample output of Question#2
Figure 4. Sample output of Question#2
COMP248/Winter 2021 – Assignment 1 Page 4 of 4
Submitting Assignment 1
Please check your course Moodle webpage on how to submit the assignment.
Evaluation Criteria for Assignment 1 (20 points)
Source Code
Comments for all 2 questions (5 pts.)
Description of the program (authors, date, purpose) 2 pts.
Description of variables and constants 1 pt.
Description of the algorithm 2 pts.
Programming Style for all 2 questions (3 pts.)
Use of significant names for identifiers 1 pt.
Indentation and readability 1 pt.
Welcome Banner or message/Closing message 1 pt.
Question 1 (4 pts.)
Prompt and display the user’s input 1 pt.
Follow the rules to encrypt the password 2 pts.
Display the correct result 1 pt.
Question 2 (8 pts.)
Prompt user’s inputs 1 pt.
Display the length of two words 1 pt
Follow the rules to generate the encrypted words 4 pts.
Display result 2 pts.
TOTAL 20 pts.