OOD – Basic Elements of ADTs – Cryptography – Shannon

Screen Shot 2015-05-01 at 11.18.58 AM

In.java

Screen Shot 2015-04-29 at 10.32.07 AM

Basic elements of a data type.

  • API.
  • Class.
  • Access modifiers.
  • Instance variables.
  • Constructors.
  • Instance methods.
  • Variable names in methods.

Basic components that you need to understand to be able to build data types in Java.

classcharge

 

NOTE:

You should be working on the programming assignment and gradient assignments before you start working on OOD programs.

 

Classwork/Homework: NO DUE DATE HAS BEEN ASSIGNED YET

These assignments are to be developed using the basic elements of data types.

Generating cryptograms. A cryptogram is obtained by scrambling English text by replacing each letter with another letter. Write a program, YI_Crypto1.java to generate a random permutation of the 26 letters and use this to map letters. Give example: Don’t scramble punctuation or whitespace.

crypto

Entropy. The Shannon entropy measures the information content of an input string and plays a cornerstone role in information theory and data compression.

Screen Shot 2015-05-05 at 8.21.45 PM        Screen Shot 2015-05-05 at 8.23.34 PM    Shannon Entropy Calculator

Shannon is famous for having founded information theory.
It was proposed by Claude Shannon in 1948, borrowing upon the concept in statistical thermodynamics. Assuming each character i appears with probability p(_{i}), the entropy is defined to be H = – sum p(_{i}) log(_{2})p(_{i}), where the contribution is 0 if p(_{i}) = 0. Compute entropy of DNA sequence.
(a) Write a program, YI_Entropy1.java to read in a ASCII text string from standard input, count the number of times each ASCII character occurs, and compute the entropy, assuming each character appears with the given probabilities.
(b) Repeat part (a) but use Unicode.

entropy1

Screen Shot 2015-05-25 at 1.40.56 AM