Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Western Cipher.java You should import java.io.*; in this class This class represents a cipher that can encode and decode information with the algorithm provided above.

image text in transcribedimage text in transcribed

Western Cipher.java You should import java.io.*; in this class This class represents a cipher that can encode and decode information with the algorithm provided above. It must have the following private variables: encodingQueue (CircularArrayQueue, type Character) decodingQueue (CircularArrayQueue, type Character) The class must have the following public methods: WesternCipher (constructor) - No parameter constructor, it initializes both the encoding and decoding queues with a capacity of 10 and as type Character Western Cipher (constructor with argument) - Takes an integer as input and initializes both the encoding and decoding queues with the capacity provided and as type Character encode(String input) - Takes a string as input, splits the string into individual characters, applies the Western Cipher algorithm described above, rejoins the individual characters into a string and returns it. While possible to implement without a queue, this method must enqueue every character into the queue and then encode while dequeueing. decode(String input) - Takes a string as input, splits the string into individual characters and undoes the Western Cipher algorithm described above. It then rejoins the individual decoded characters, gathers them into a string and returns it. While possible to implement without a queue, this method must enqueue every character into the queue and then decode while dequeueing. Main method - This requirement is not assessed in the tests. The main method must prompt the user about whether it would like to encode or decode a string, take the string and encode/decode as appropriate, and then prompt the user if they would like to enter another string. If no is selected, the program should exit. Hints: Look at the provided cipher code for a starting point. You will need to remember % You can do integer math by converting the starting character 'A' or the ending character Z and adding or subtracting the appropriate number of letters to move. The decoder has to undo the encode operations exactly. Western Cipher.java You should import java.io.*; in this class This class represents a cipher that can encode and decode information with the algorithm provided above. It must have the following private variables: encodingQueue (CircularArrayQueue, type Character) decodingQueue (CircularArrayQueue, type Character) The class must have the following public methods: WesternCipher (constructor) - No parameter constructor, it initializes both the encoding and decoding queues with a capacity of 10 and as type Character Western Cipher (constructor with argument) - Takes an integer as input and initializes both the encoding and decoding queues with the capacity provided and as type Character encode(String input) - Takes a string as input, splits the string into individual characters, applies the Western Cipher algorithm described above, rejoins the individual characters into a string and returns it. While possible to implement without a queue, this method must enqueue every character into the queue and then encode while dequeueing. decode(String input) - Takes a string as input, splits the string into individual characters and undoes the Western Cipher algorithm described above. It then rejoins the individual decoded characters, gathers them into a string and returns it. While possible to implement without a queue, this method must enqueue every character into the queue and then decode while dequeueing. Main method - This requirement is not assessed in the tests. The main method must prompt the user about whether it would like to encode or decode a string, take the string and encode/decode as appropriate, and then prompt the user if they would like to enter another string. If no is selected, the program should exit. Hints: Look at the provided cipher code for a starting point. You will need to remember % You can do integer math by converting the starting character 'A' or the ending character Z and adding or subtracting the appropriate number of letters to move. The decoder has to undo the encode operations exactly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions