Question: Lab 4 Tasks You will implement a Caesar object, which is an object that can perform encryption and decryption in our modified Caesar Cipher operation.
Lab Tasks
You will implement a "Caesar" object, which is an object that can perform encryption and decryption in our modified Caesar Cipher operation.
This Caesar object should have exactly one field: an integer representing the key to the cipher. This field should be private and you should have a corresponding getter and setter.
The class does not need to include a constructor. If you choose to include any, make sure the default constructor is callable.
You must implement an 'encrypt' method, which performs encryption based on the modified Caesar Cipher described above with the following signature:
public String encryptString plaintext
plaintext is the message to be encrypted
The method should return the ciphertext, encrypted using this object's key
You must implement an 'decrypt' method, which performs decryption based on the modified Caesar Cipher described above.
public String decryptString ciphertext
ciphertext is the encrypted message to be decrypted
The method should return the plaintext message, decrypted with this object's key
You are encouraged to write a main method to test your two methods but your main method will not be tested by the AutoTester.
Example main method with output
public static void mainString argos
Caesar cipher new Caesar;
cipher.setKey;
System.out.printIncipherencrypthello WORLD!"; prints "KHOOR zruog!"
System.out.printIncipherdecryptKHOOR zruog!"; prints "hello WORLD!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
