Your Class Should Include 3 Methods

Your Class Should Include 3 Methods

<p>Lab #9 (10 points) Due: Thursday, May 4</p><p>1. Write a program that reads in a sentence, then prints it out in reverse order. For example, the program should display uoy evol I for the input: I love you Your class should include 3 methods:  obtain, which reads the original sentence  report, which prints out the reverse  main, which tests the other two methods 2. Add a method that displays the characters in the input sentence (including spaces) as their numeric ASCII values. For example, the input “I love you” would produce the output:</p><p>73 32 108 111 118 101 32 121 111 117</p><p>Modify your main method so that it tests your new display method (don’t replace the old one!). 3. Add one more method, which implements a Caesar cipher on your text. The Caesar cipher works by shifting each letter of the text N positions up in the alphabet, where N is some integer. The example below shows the uppercase letters of the English alphabet shifted 5 positions:  original: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z  enciphered: F G H I J K L M N O P Q R S T U V W X Y Z A B C D E Note that the alphabet "wraps around" once it reaches the end – thus, V maps to A, W maps to B, and so forth. The message "I LOVE YOU" enciphered in this fashion would be: N QTAJ DTZ You method should:  prompt the user for N  Display the message with each letter shifted N positions; keep the spaces and the case intact – this means that you will have to be sure that both versions of the alphabet wrap appropriately. 4. Modify your main method so that it contains a loop that:  Displays a menu describing the three encryption options and a quit option  If the user chooses an option other than quit, prompts for an input String and calls the appropriate method  Continues this process until the user chooses to quit.</p><p>Turn in a printout of your source code (with your name on it!).</p><p>Computer Science I Spring 2006 Sheller Page 1 cs1s06lab9(charstrings) - work</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us