Write a class polybius, that encrypts and decripts strings

Assignment Help Basic Computer Science
Reference no: EM131317300

Question 1

Polybius was an ancient Greek writer who first proposed a method of substituting different two-digit numbers for each letter. The alphabet is written inside a 5-by-5 square matrix which has numbered rows and columns:


1

2

3

4

5

1

A

B

C

D

E

2

F

G

H

I

J

3

K

L

M

N

O

4

P

Q

R

S

T

5

U

V

W

X

Y/Z

Note that Y and Z are written in the last cell to divide the letters evenly. The context of the message should make clear which of the two letters is intended.

To encode, substitute for each letter the numbers marking the row and column in which the letter appears. Always put the row number first. For example, the number J is 25. The number for J is 25.

The word WATERMELON would be encode as:

53114515433315323534

To decode, simply locate each letter indicate by the number. The number, 53, tells you to find the letter at the intersection of the fifth row and the third column.

Write two function encode and decode. Encode accepts a string of upper case letters and returns a string of digits. Decode accepts a string of digits and returns a string of upper case letters.

Write a function alphaSqueeze that accepts an arbitrary string and returns a string of upper case letters. alphaSqueeze, Write a function digitSqueeze that accepts an arbitrary string and returns a string of digits.

e.g. alphaSqueeze("Ralph124c41") returns "RALPHC" and digitSqueeze("Ralph124c41") returns "12441"

Write a program to thoroughly test the functions.

Question 2

Write a class, Polybius, that encrypts and decripts strings using the Polybius checker board. The class members are decode, encode, alphaSqueeze, digitSqueeze, and the 5 x 5 square matrix described in Polybius Checkerboard 1. The decode and encode are the only public members. alphaSqueeze, digitSqueeze and the matrix are private..

Reference no: EM131317300

Write a gui java application

There should be proper documentation in the source code. The documentation should include a block containing the name of the program and the name of the student, and a short

Benefits of using enterprise systems

What are some collaboration tools that are available for people to work together? How can businesses collaborate with their customers and/or with other businesses? What are

Physical vs logical system models

Your intern is confused about the difference between physical and logical system models.  Explain the difference between the two models to her and give at least one example

Find the expressions for center of mass

If an object of uniform density is approximated by the polygon obtained by joining the adjacent control points by straight lines, find the expressions for center of mass, pe

Perform a search on the world wide web

There are a wide variety of hacker tools. Perform a search on the World Wide Web and review the hacking tools that are available. Evaluate the available tools and explain wh

Calculate the bandwidth necessary for transmitting

HDCD high-definition audio of 24-bit samples at 88.2 KHz. 30 Discuss the relative performance needs of the following applications, in terms of average bandwidth, peak bandwi

Data quality can be assessed in terms of several issues

Data quality can be assessed in terms of several issues, including accuracy, completeness, and consistency. For each of the above three issues, discuss how data quality asse

How many passes did the diagnostic tool run

Diagnose one of your drawing files and fix any errors detected. Display the text of the AutoCAD message. How many passes did the diagnostic tool run? How many objects were i

Reviews

Write a Review

 
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd