Question: In Java, and using the methods from the CircularArrayQueue.java, please create the methods encode and decode methods using the encryption algorithm below. To be specific,

In Java, and using the methods from the CircularArrayQueue.java, please create the methods encode and decode methods using the encryption algorithm below. To be specific, I am not asking that you create the CircularArrayQueue.Java nor am I asking to put the encode and decode methods in the CiruclarArrayQueue.Java. I would like just to see the algorithm function in a methods that take in a string and encodes or decodes them based on the descriptions below.

In Java, and using the methods from the CircularArrayQueue.java, please create themethods encode and decode methods using the encryption algorithm below. To be

******************************CREATE THESE METHODS*************************************************

specific, I am not asking that you create the CircularArrayQueue.Java nor am

**************************************************************************************************

I asking to put the encode and decode methods in the CiruclarArrayQueue.Java.I would like just to see the algorithm function in a methods

Encryption is an important consideration when transmitting information over insecure mediums. One of the ways that this has been done historically is with the use of a cipher. This assignment details making a custom cipher called the 'Western Cipher', and you will be tasked with implementing the encoding and decoding algorithm, alongside using a Circular Array Queue as described in class. This cipher will be used to encode messages strictly consisting of upper case alphabetical characters (i.e., A-Z, no numbers, punctuation, etc) and spaces, i.e., The custom cipher we are implementing has the following rules: 1. All letters are always shifted forwards 5 steps in the alphabet. For example, A would be shifted forward to 'F', and 'B' would be shifted to 'G'. 2. All letters are shifted an additional 2 steps forward for every spot in the length of the message they are, starting with an index of 0. So, for example, the 'AB' from above would be shifted to 'Fl'. 3. All values listed below are replaced with the following values according to the table: A 1 E 2 1 3 o 4 U 5 Y 6 This means that 'AB' would now become '11' This takes priority over the previous rules for the individual letter substituted, so there is no shift in the alphabet before the conversion. Letters shifted to become values in table 3 should not be converted to numbers. 4. If the previous letter was converted to a numerical value, the letter that follows should be shifted backwards by twice the amount that the letter was converted to. So, for example, AB' becomes first '1B', and then B is shifted forward 5 steps from rule 1, 2 steps from rule 2, and then 2 backwards by this rule, 4. So the encoded message would now be '16 5. If the previous letter was converted to a numerical value, and the next value is also to be converted to a numerical value, use the following table for encryption instead of following rule 4: E 1 O U Y 3 4 5 6 1 2 So 'AA' would become '13', 'AE' would become '14', and 'YA' would become '63'. 'YOU' would become '661'. These are the rules your cipher must follow. We recommend writing out pseudocode for this process, as the listed order from 1-5 may not be the ideal one from which to convert this into an algorithm. For the second part of the assignment, you must also implement a decoder method which takes an encoded string and returns it to it's original form. This should undo all of the operations above in the appropriate order such that a message can be encoded and decoded without any loss of information or mistakes, i.e., 'AA' becomes '12' and '12' becomes 'AA' again. 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. CircularArray Queue.java This class represents a Queue implementation using a circular array as the underlying data structure. This class must implement the QueueADT and work with the generic type (T). This class must have the following private variables: front (int) rear (int) count (int) queue (Tarray) DEFAULT_CAPACITY (final int) with a value of 20 The class must have the following public methods: CircularArrayQueue (constructor) no parameters required in this first constructor. Initialize the front to 1, rear to the default capacity (DEFAULT_CAPACITY), count to 0, and the queue array using the final int variable DEFAULT_CAPACITY as the array's capacity. CircularArrayQueue (second constructor) - same as the first constructor described above, except that this one takes in an int parameter for the initial capacity rather than using the default capacity. Front and rear are set to 1 and initialCapacity respectively. enqueue - takes in an element of the generic type and adds that element to the rear of the queue. If the queue is full before adding this item, then call expandCapacity. dequeue - throws an Empty CollectionException if the queue is empty; otherwise remove and return the item at the front of the stack. first throws an Empty CollectionException if the queue is empty; otherwise return the item at the front of the queue without removing it. isEmpty - returns true if the queue is empty, and false otherwise. size - returns the number of items on the queue. getFront - returns the front index value (NOTE: this is not part of the Queue ADT but is still required for this assignment). getRear returns the rear index value (NOTE: this is not part of the QueueADT but is still required for this assignment). getLength - returns the current length (capacity) of the array (NOTE: this is not part of the QueueADT but is still required for this assignment). toString - returns the string containing "QUEUE:" followed by each of the queue's items in order from front to rear with ", " between each of the items and a period at the end of the last item. If the queue is empty then print "The queue is empty" instead. expandCapacity (private) - create a new array that has 20 more slots than the current array has, and transfer the contents into this new array and then point the queue instance variable to this new array by resetting the front and rear appropriately. You may set the front to 1 and the rear to count when expanding the array instead of the DEFAULT_CAPACITY based front and rear. Encryption is an important consideration when transmitting information over insecure mediums. One of the ways that this has been done historically is with the use of a cipher. This assignment details making a custom cipher called the 'Western Cipher', and you will be tasked with implementing the encoding and decoding algorithm, alongside using a Circular Array Queue as described in class. This cipher will be used to encode messages strictly consisting of upper case alphabetical characters (i.e., A-Z, no numbers, punctuation, etc) and spaces, i.e., The custom cipher we are implementing has the following rules: 1. All letters are always shifted forwards 5 steps in the alphabet. For example, A would be shifted forward to 'F', and 'B' would be shifted to 'G'. 2. All letters are shifted an additional 2 steps forward for every spot in the length of the message they are, starting with an index of 0. So, for example, the 'AB' from above would be shifted to 'Fl'. 3. All values listed below are replaced with the following values according to the table: A 1 E 2 1 3 o 4 U 5 Y 6 This means that 'AB' would now become '11' This takes priority over the previous rules for the individual letter substituted, so there is no shift in the alphabet before the conversion. Letters shifted to become values in table 3 should not be converted to numbers. 4. If the previous letter was converted to a numerical value, the letter that follows should be shifted backwards by twice the amount that the letter was converted to. So, for example, AB' becomes first '1B', and then B is shifted forward 5 steps from rule 1, 2 steps from rule 2, and then 2 backwards by this rule, 4. So the encoded message would now be '16 5. If the previous letter was converted to a numerical value, and the next value is also to be converted to a numerical value, use the following table for encryption instead of following rule 4: E 1 O U Y 3 4 5 6 1 2 So 'AA' would become '13', 'AE' would become '14', and 'YA' would become '63'. 'YOU' would become '661'. These are the rules your cipher must follow. We recommend writing out pseudocode for this process, as the listed order from 1-5 may not be the ideal one from which to convert this into an algorithm. For the second part of the assignment, you must also implement a decoder method which takes an encoded string and returns it to it's original form. This should undo all of the operations above in the appropriate order such that a message can be encoded and decoded without any loss of information or mistakes, i.e., 'AA' becomes '12' and '12' becomes 'AA' again. 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. CircularArray Queue.java This class represents a Queue implementation using a circular array as the underlying data structure. This class must implement the QueueADT and work with the generic type (T). This class must have the following private variables: front (int) rear (int) count (int) queue (Tarray) DEFAULT_CAPACITY (final int) with a value of 20 The class must have the following public methods: CircularArrayQueue (constructor) no parameters required in this first constructor. Initialize the front to 1, rear to the default capacity (DEFAULT_CAPACITY), count to 0, and the queue array using the final int variable DEFAULT_CAPACITY as the array's capacity. CircularArrayQueue (second constructor) - same as the first constructor described above, except that this one takes in an int parameter for the initial capacity rather than using the default capacity. Front and rear are set to 1 and initialCapacity respectively. enqueue - takes in an element of the generic type and adds that element to the rear of the queue. If the queue is full before adding this item, then call expandCapacity. dequeue - throws an Empty CollectionException if the queue is empty; otherwise remove and return the item at the front of the stack. first throws an Empty CollectionException if the queue is empty; otherwise return the item at the front of the queue without removing it. isEmpty - returns true if the queue is empty, and false otherwise. size - returns the number of items on the queue. getFront - returns the front index value (NOTE: this is not part of the Queue ADT but is still required for this assignment). getRear returns the rear index value (NOTE: this is not part of the QueueADT but is still required for this assignment). getLength - returns the current length (capacity) of the array (NOTE: this is not part of the QueueADT but is still required for this assignment). toString - returns the string containing "QUEUE:" followed by each of the queue's items in order from front to rear with ", " between each of the items and a period at the end of the last item. If the queue is empty then print "The queue is empty" instead. expandCapacity (private) - create a new array that has 20 more slots than the current array has, and transfer the contents into this new array and then point the queue instance variable to this new array by resetting the front and rear appropriately. You may set the front to 1 and the rear to count when expanding the array instead of the DEFAULT_CAPACITY based front and rear

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!