Assignment 3
Question 1 (6pts) – 3D-Space Encryption-Decryption Program
With reference to our Space-Exploration program (from Assignment 1) tagged: “Project-S”. In your capacity as a Research Intern working and operating from the ground station of Project-S, one of your key responsibilities include: sending and receiving messages from your colleagues operating at the space station of Project-S. To this end, your supervisor(s) have charged you with the sole responsibility of designing an EncryptionDecryption algorithm, and developing this same algorithm using Java Programming Language.
Essentially, this algorithm computes the ciphertext by ingesting and preprocessing any given string/text to ensure that the first and last characters of the string/text is a non-space character; thereafter, it counts the number of characters in the string/text. If the preprocessed string/text is comprised of an even number of characters; then, based on Java Indexing paradigm, every even-index character is switched with the nearest odd-index character until the end character. If the preprocessed string/text is comprised of an odd number of characters; then, based on Java Indexing, the first character is isolated while each succeeding odd-index character is switched with the nearest even-index character until the end index. Please see Table 1 below for pictorial explanation.
Table 1. Procedure for Project-S Encryption-Decryption algorithm Text Original
Ciphertext
Even
Odd
Therefore, write a Java class/program such that your source code will accomplish the following:
- Name of the class/program = A3_Q1.
- Display a welcome/salutation message to the user of the program.
- Display a prompt message for the user to enter a string/text for the encryption-decryption algorithm.
- Validate the user’s input to ensure that ONLY a string/text comprising valid characters has been entered. If otherwise, display the respective error message and end the program.
- Preprocess the input string/text as described above; and compute the corresponding ciphertext based on our proposed encryption algorithm.
- Additionally, note that: if an output ciphertext is passed through our proposed algorithm and program, then the ciphertext shall be decrypted to reveal the original/plain text.
- Finally, display a complimentary-close message as follows: Thank you for your contribution to this Space Project. The following are sample screenshots to illustrate the expected behavior of your program. Your program must display the same information, using the same format, depicted in the screenshots:
Figure 1. Sample-1 output of Question 1
Figure 2. Sample-2 output of Question 1
Figure 3. Sample-3 output of Question 1
Figure 4. Sample-4 output of Question 1
Figure 5. Sample-5 output of Question 1
Question 2 (8pts) – Simple Electronic Voting System (SEVS)
Electioneering and Polling are vital activities with regard to every government and/or democratic process. Thus, you have been tasked with the responsibility of designing and developing (using Java Programming Language) a Simple Electronic Voting System (SEVS) which possesses the following capabilities, displayed as a menu window to the electoral manager, viz:
Code | Description |
---|---|
1 | Display candidates |
2 | Vote a candidate |
3 | Add new candidates(s) |
4 | Display results |
0 | End SEVS |
Firstly, the particulars of every candidate is formatted in the form: {id_1},{name_1}. Hence, the SEVS prompts the electoral manager to enter a list of particulars for all eligible candidates, as a string/text input, into the program with respect to the following format: {id_1},{name_1};{id_2},{name_2};.... In other words, the input string/text comprises of several candidate’s particulars separated via a semicolon; and in each candidate’s details, the candidate’s ID is separated from the candidate’s name via a comma. Therefore, write a Java class/program such that your source code will accomplish the following:
- Name of the class/program = A3_Q2.
- Display a welcome/salutation message to the user of the program.
- Display a prompt message for the user to enter all candidates’ particulars; thereafter, display a prompt message to the user for an input code.
- If the input code is 1; kindly display a complete list of all eligible candidates based on the display representations depicted via Figures 7 and 10.
- If the input code is 2; kindly prompt the electorate/user to enter the ID of the candidate s/he wishes to vote for as depicted via Figure 8.
- If the input code is 3; prompt the electoral manager to enter a string/text input comprising a collection of all the new candidates’ particulars that should be appended to the already existing list of eligible candidates. Thus, see Figure 9.
- If the input code is 4; please display a comprehensive and intuitive list of the electoral results, such that if 2 or more candidates possess same votes/ballots then these candidates should bear same position, as portrayed in Figure 11.
- Validate every input from the electoral manager/user to ensure that ONLY a valid input code is entered into the SEVS. If otherwise, display a warning message (as depicted in Figure 13) which will always re-prompt the user to re-enter a valid input code.
- Finally, if the input code is 0; kindly terminate the execution of SEVS with a complimentclose message as follows (see Figure 12):
Thank you for using our Simple Electronic Voting System (SEVS)
The following are sample screen shots to illustrate the expected behavior of your program. Your program must display the same information, using the same format, as depicted below:
Figure 6. Sample-1 output of Question 2
Figure 7. Sample-2 output of Question 2
Figure 8. Sample-3 output of Question 2
Figure 9. Sample-4 output of Question 2
Figure 10. Sample-5 output of Question 2
Figure 11. Sample-6 output of Question 2
Figure 12. Sample-7 output of Question 2
Figure 13. Sample-8 output of Question 2