Reference no: EM132392298
PROG 1101C Programming Concept Assignment - University Of Technology, Mauritius
For both questions, Q1 and Q2, you are strongly advised to use methods and multi-file/class approach.
Q1. YOU WILL BE HANG GAME
Write an algorithm + a JAVA program to implement the 'YOU WILL BE HANG' game.
The game will be played between two players (P1 & P2) at a time but in your game you can cater for a maximum of four (4) players i.e. P1, P2, P3, and P4.
Let us assume P1 plays against P2.
P1 asks P2 how many letters long word P2 wishes to play; the longer the word, the more will be the score for the winner.
While P1 types in the word, he/she should hide it from P2 and at the same only asterisk symbols will be displayed.
E.g. If P2 asks for 11 characters word;
P1 types the Word: ***********
If P2 wins, the full word is displayed: COMPOSITION; else for each wrong characters guessed by P2, successive characters from the following phrase '' is displayed until P2 is hanged and loses the game. Subsequently P1 obtains the equivalent marks and wins the game.
The game can be played repeatedly between the two players in several rounds and their scores for each round and the overall are displayed as well as the winner of each round and the overall.
The complexity of the program and the game can be increased by proposing four players (P1, P2, P3, and P4) and saving their stats permanently in an output file.
Your report should include -
(i) A copy of all algorithms and/or flowchart, program specification,
(ii) Your FULL JAVA code
(iii) Your test cases + appropriate files for testing purposes
(iv) Output screen - screen shots
(v) Conclusion.
Q2. Compression - Run Length Encoding (RLE)
Write an algorithm and a corresponding JAVA program which takes an input sequence of characters from the alphabet {A,B,C...Z} and compresses it by replacing each subsequence of a particular character by a single occurrence of the character, and the frequency of occurrence of that character.
e.g. Input : AAAAABBBBBBBCCBBBAABBCCCCCS (27 x 8 bits = 216 bits)
Output: A5B7C2B3A2B2C5 (14 x 8 bits = 112bits)
Assuming that each character uses an 8-bit ASCII code your program should also calculate the percentage of compression.
Your report should include
(i) A copy of all algorithms and/or flowchart, program specification,
(ii) Your FULL JAVA code
(iii) Your test cases + appropriate files for testing purposes
(iv) Output screen - screen shots
(v) Conclusion.
Attachment:- Programming Concept Assignment File.rar