Skip to main content
Lesson 13 - String Class
ZIPPDF (letter)
Lesson MenuPreviousNext
  
L.A.13.2 - Shorthand page 11 of 12

"t s bttr 2 rmn slnt & thght fl, thn 2 spk p & rmv ll dbt." - A. Lincoln

Assignment:

  1. Write a program that repeatedly accepts a line of input and produces the shorthand form of that line.

  2. The shorthand form of a string is defined as follows:

    1. replace these four words: "and" with "&", "to" with "2", "you" with "U", and "for" with "4".
    2. remove all vowels ('a', 'e', 'i', 'o', 'u', whether lowercase or uppercase)

  3. Your program should keep prompting the user for strings and printing out the shorthand version until the user enters "Q" or "q" (which will signal termination of the program).


Instructions:

  1. Use these sample phrases as inputs for your run outputs:

    You can pretend to be serious; you can't pretend to be witty
    for For to you YOU and TO and
    Humuhumunukunukuapua'a - Hawaiian state fish
    2 + 2 = 4
    This is FOR YOU TO try AND convert.
  2. Here are sample run outputs

    Welcome to the Shorthand Message Generator!
    
    Enter a message: You can pretend to be serious; you can't pretend to be witty
    U cn prtnd 2 b srs; U cn't prtnd 2 b wtty
    
    Enter a message: for For to you YOU and TO and
    4 4 2 U U & 2 &
    
    Enter a message: Humuhumunukunukuapua'a - Hawaiian state fish
    Hmhmnknkp' - Hwn stt fsh
    
    Enter a message: 2 + 2 = 4
    2 + 2 = 4
    
    Enter a message: This is FOR YOU TO try AND convert.
    Ths s 4 U 2 try & cnvrt.
    
    Enter a message: Q
  3. Turn in your source code and run outputs.


Lesson MenuPreviousNext
Contact
 ©ICT 2003, All Rights Reserved.