1920

Academic Year 2018/19

ENG421 Introduction to Programming and Algorithms

Coursework 2

Deadline For Submission:

Friday May 3rd 2019
Coursework may be submitted up until 15:00 of the due date

Submission Instructions

Submission made to the CW2 link on the ENG421 Moodle page.

Instructions for completing the
assessment:

Please upload your full code in as text file (.txt). Your code must be
ready to compile so please test it before submission.

Examiners:

Dr Josh Robertson

ENG421
2018-19 Page | 1
This coursework contributes 40% to the ENG421 unit mark.
Course Assignment:
Write a C program to implement a Vigenère cipher, which will be used to encrypt plain text and
decrypt cipher text to a text file.
The program must do the following:
● Initially, the cipher key must be declared and initialised in the source code with the following
information:
○ The length of the cipher key must be the length of your surname/family name
○ The first two letters of the cipher should be from your first name
○ The next two letters from your surname/family name
○ (If) any letters are needed after that, they should be made up of your middle name or
mother name.
For example, my key would be nine characters long and initialised as ‘JOROJAMES’
● Provide a menu-based system, which allows the user to select an option to either 1) encrypt
2) decrypt, 3) enter a new key or 4) exit. The menu system must loop if either option one,
two or three has been selected.
● For option 4, the exit should return the correct value to indicate end of the program.
● For option 3, the program should request the user to enter a cipher key as string, which must
between 2 to 16 characters in length and may only contain lower case characters of the
alphabet (a-z). It should not accept other characters e.g. 0,1,2,3,4.. !, ?, #, , …
● For options 1 and 2; the program should load a text file which must be at least 5 to 256
characters in length and contain only lowercase characters of the alphabet (a-z) and white
spaces. Decryption should overwrite any previous text but both options must use the same
text file.
● All output of encrypted and decrypted text should be saved as a text (.txt) document
Additionally, the program must display the following output:
● For encryption; The number of places each plain text letter moves by according to
the key, e.g. if the key is “ABC” and the text is 4 characters long – move first plain text
character by 0, second by 1, third by 2 and fourth by 3. An output message should
display the number of steps moved for each character and,
● The resulting encrypted text at each step
● Finally, a confirmation that the entirety of the encrypted/cipher text has been saved to
a .txt file
● The previous three steps should be in place for the decryption cycle but by reversing
or applying the required changes for encrypted text to plain text
ENG421
2018-19 Page | 2
The coursework must contain pseudo code of the solution at the top program (enclosed with
source code comments delimiters). Source code comments are required to explain the
implementation.
A five mark deduction will be made if the pseudocode is not commented out in the final
submission. (I.e. if put straight into a compiler, it won’t try to execute the code)
Programs may be able to be written in different IDEs but must be compliable with CodeBlocks.
Marking Criteria can be seen below

Marks

Program Output & Features

28-40

● Pseudo code clearly explains key source code
features
● Program handles all input errors and displays
informative error messages
● Program correctly handles the required input and
provides the required output

20-24

● Pseudo code explains some code features
● Program handles some input errors and displays
error messages
● Correctly handles required input and provides
required output

12-16

● Program partially handles required input and
provides required output for some test cases

4-8

● Program shows minimal effort to handle the
required input or provide required output
● Program fails to compile

Marks

Source code organisation and efficiency

28-60

● Consistent use of efficient techniques to improve
the source code maintenance or performance
● Efficient structures are used to organise source
code
● Logical flow of the program is clearly visible within
the source code and comments

20-24

● Some efficient techniques have been applied
● Some useful structures are used to organise source
code
● Logical flow of the program can be observed from
the source code and source comments

12-16

● Some basic structure is used to organise source
code
● Some simple logical flow is observed

4-8

● Lack of structure for the source code, or
● Difficult to follow the logical flow of the program