Tue. Aug 4th, 2020

Program Design & Problem Solving Assignment-02: Data Structure

4 min read

TTTK1143: Rekabentuk Aturcara & Penyelesaian Masalah / Program Design & Problem Solving
Assignment-02: Data Structure
PROJECT-02/1
“dits-dahs”
Input Standard Input & File
Output Standard Output
Problem Description
Swallow Reef, also known as Pulau Layang-Layang, is an oceanic atoll of the Spratly Islands
administered by Malaysia, which is situated approximately 300 kilometres northwest of Kota Kinabalu,
Sabah. The atoll is about 7 km long and 2 km wide. There is a lighthouse on the atoll that sends weather
and security conditions periodically to the mainland. Due to the long distance and atmospheric
surroundings which are not conducive to modern telecommunications, the only means of
communication is by using Morse Code over a low powered radio transceiver.
Morse code is a method used in telecommunication to encode text characters as standardized sequences
of two different signal durations, called dots and dashes or dits and dahs. Morse code is named
after Samuel Morse, an inventor of the telegraph. The International Morse Code encodes the 26 English
letters A through Z, some non-English letters, the Arabic numerals (ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8
and 9 ) and small set of punctuation and procedural signals (prosigns). There is no distinction between
upper and lower case letters. The following figure shows a list of Morse codes for characters, symbols
and Arabic numerals.
Figure 1 – Morse Code – Letters conversion
Morse Code needs trained and experienced officers to be able to communicate efficiently and not easy
to obtain as Morse Code usage is getting less and lesser by time. Thus it is best to have a program that
can encode and decode Morse messages so that any officer can read or send them in plain text. Your
task is to create the java program to help officer to encode and decode the code Morse. You must use
appropriate data structure for all Morse code (as in Fig 1) by ensuring that each code is unique.
TTTK1143: Rekabentuk Aturcara & Penyelesaian Masalah / Program Design & Problem Solving
Assignment-02: Data Structure
PROJECT-02/2
Although in real life, the codes are send as sounds, in this program, dots are written as “.” and
dashes/dahs are “-“. Letters are separated by a space, while one word to another are separated by two
spaces.
The program should print a menu to perform three main process; sending, receiving and display all
letters and Morse code.
i. The sending part should be able to encode or convert any letters in Fig 1 to Morse Code and
ready to be sent across to the other side. Every message must starts with “VV” or “…- …-” and
ends with “EOM” or “. — –” . To ensure the integrity of each message, a transmission summary
must be appended after the “EOM” marker. The summary must contain:
1. Number of lines in the message.
2. Number of words
3. Number of Alphabets
4. Number of Symbols
5. Number of numbers (Arabic numerals)
An “EOT” marker must be put at the end of the transmission summary.
ii. The receiving part should be able to decode the Morse message and transmission summary into
readable letters. For the verification purposes, a summary analysis will be generated based on
the decoded message to be compared with the transmission summary from the sender. The
comparison will print out “Consistent Summary” if the two messages equal, otherwise print
“Inconsistent Summary”.
iii. Display all letters and Morse Code part should print out all letters with Morse code in the
format of 5 output in a row using one of the data structure traversal method. (Hint: use format
“\t” in the print statement to make space in between output)
Sample Input-output table shows the example of valid input with the corresponding output. Your
program need to consider the invalid input.
You can refer to any online link to check the result of decode and encode the Morse Code. (example:
https://morsecode.world/international/translator.html )
TTTK1143: Rekabentuk Aturcara & Penyelesaian Masalah / Program Design & Problem Solving
Assignment-02: Data Structure
PROJECT-02/3
Sample Input/output
Input Output
1
VV
Sunny sky
wind 40 knots
temp 35C
EOM
…- …-
… ..- -. -. -.– … -.- -.–
.– .. -. -.. ….- —– -.- -. — – …
– . — .–. …– ….. -.-.
. — —
…..
—-.
…– .—-
—–
….-
. — –
Menu:
1. Send Morse Message
2. Receive Morse Message
3. Print Letters and Morse Code
4. Exit
Input code:
2
…- …-
… ..- -. -. -.– … -.- -.–
.– .. -. -.. ….- —– -.- -. — – …
– . — .–. …– ….. -.-.
. — —
…..
—-.
…– .—-
—–
….-
. — –
VV
SUNNY SKY
WIND 40 KNOTS
TEMP 35C
EOM
5
9
31
0
4
EOT
5 9 31 0 4
Result: Consistent Summary
Menu:
1. Send Morse Message
TTTK1143: Rekabentuk Aturcara & Penyelesaian Masalah / Program Design & Problem Solving
Assignment-02: Data Structure
PROJECT-02/4
2. Receive Morse Message
3. Print Letters and Morse Code
4. Exit
Input code:
3 5 ….. H …. 4 ….- S … V …-
3 …– I .. F ..-. U ..- ? ..–..
2 ..— E . L .-.. ” .-..-. R .-.
. .-.-.- A .- P .–. @ .–.-. W .–
J .— ‘ .—-. 1 .—- 6 -…. – -….-
B -… = -…- D -.. X -..- N -.
C -.-. ; -.-.-. ! -.-.– K -.- ( -.–.
) -.–.- Y -.– T – 7 –… Z –..
, –..– G –. Q –.- M — : —…
8 —.. O — 9 —-. 0 —–
Menu:
1. Send Morse Message
2. Receive Morse Message
3. Print Letters and Morse Code
4. Exit
Input code:
4 Bye dits-dahs..
TTTK1143: Rekabentuk Aturcara & Penyelesaian Masalah / Program Design & Problem Solving
Assignment-02: Data Structure
PROJECT-02/5
DELIVERABLES AND SUBMISSION
Your report should include the following information submitted in 2 files:
File Named & format file Details Percentage
1 _File1.pdf 1. Describes all data structures
used in dits-dahs problem.
2. Illustrates the structure of
Morse Code after insert all the
letters used.
3. Describes all classes used in
dits-dahs (list all attributes and
methods involve in each class
and state the objective).
4. Algorithm for:
i. Main method
ii. Encode method
iii. Decode method
iv. Display all letters and
Morse code.
5. Any assumptions that you
made.
6. Input-Output Screen short
10% Markah
2 _File2.dat 7. Data Files
3 _filename1.java
_filename2.java
_filename3.java
8. Full Java codes of dits-dahs. 20% Markah
Jumlah 30%
Zipped all files and submit to UKMFolio by 3/7/2020 before 5pm.
-SELAMAT MAJU JAYA-

Copyright © All rights reserved. | Newsphere by AF themes.