Assignment 3 Solution

$30.00 $24.00

a method stringInBounds which takes a string plainText and returns a Boolean value Initialize a Boolean ok to true Start a for loop (int i=0; i<plainText.length(); i++) if (plainText.charAt(i) < LOWER_BOUND || plainText.charAt(i) > UPPER_BOUND), return false close for loop return true Create a method encryptCaesar which takes a string plainText and an int key…

Rate this product

You’ll get a: zip file solution

 

Description

Rate this product
  1. a method stringInBounds which takes a string plainText and returns a Boolean value
  2. Initialize a Boolean ok to true
  3. Start a for loop (int i=0; i<plainText.length(); i++)
  4. if (plainText.charAt(i) < LOWER_BOUND || plainText.charAt(i) > UPPER_BOUND), return false
  5. close for loop
  6. return true

  1. Create a method encryptCaesar which takes a string plainText and an int key and returns a string value
  2. Initialize a string encryptedText to “”
  3. if(stringInBounds(plainText)), Start a for loop for (int i=0; i<plainText.length(); i++)
  4. initialize a char thisChar to plainText.charAt(i)
  5. initialize an int encryptedCharInt to ((int)thisChar+key)
  6. while (encryptedCharInt>UPPER_BOUND), subtract encryptedCharInt by RANGE
  7. increase encryptedText by (char)encryptedCharInt
  8. close for loop
  9. return encryptedText

  1. Create a method encryptBellaso which takes two strings plainText and bellasoStr and returns a string value
  2. Initialize a string encryptedText to “”
  3. Initialize int bellasoStrLength to bellasoStr.length()
  4. if(stringInBounds(plainText)), Start a for loop for (int i=0; i<plainText.length(); i++)
  5. initialize a char thisChar to plainText.charAt(i)
  6. initialize an int encryptedCharInt to ((int)thisChar+(int)bellasoStr.charAt(i %bellasoStrLength))
  7. while (encryptedCharInt>UPPER_BOUND), subtract encryptedCharInt by RANGE
  8. increase encryptedText by (char)encryptedCharInt
  9. close for loop
  10. return encryptedText

  1. Create a method decryptCaesar which takes a string encryptedText and an int key and returns a string value
  2. Initialize a string decryptedText to “”
  3. Start a for loop for (int i=0; i< encryptedText.length(); i++)
  4. initialize a char thisChar to encryptedText.charAt(i)
  5. initialize an int decryptedCharInt to ((int)thisChar-key)
  6. while (decryptedCharInt<LOWER_BOUND), increase decryptedCharInt by RANGE
  7. increase decryptedText by (char) decryptedCharInt
  8. close for loop
  9. return dencryptedText

  1. Create a method dencryptBellaso which takes two strings encryptedText and bellasoStr and returns a string value
  2. Initialize a string dencryptedText to “”
  3. Initialize int bellasoStrLength to bellasoStr.length()
  4. Start a for loop for (int i=0; i<encryptedText.length(); i++)
  5. initialize a char thisChar to encryptedText.charAt(i)
  6. initialize an int dencryptedCharInt to ((int)thisChar-(int)bellasoStr.charAt(i %bellasoStrLength))
  7. while (dencryptedCharInt<LOWER_BOUND), increase dencryptedCharInt by RANGE
  8. increase dencryptedText by (char)dencryptedCharInt
  9. close for loop
  10. return dencryptedText
Assignment 3 Solution
$30.00 $24.00