Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TextConverter JAVA Write a program that prompts for a line of text and then transforms the text based on chosen actions. Actions include reversing the

TextConverter JAVA

Write a program that prompts for a line of text and then transforms the text based on chosen actions. Actions include reversing the text and converting the text to leet-speak. You may be able to imagine extending to other actions such as a pig-latin translator, or encoding or decoding a secret message. Turn in the version specified here before extending.

Welcome to the Text Converter. Available Actions: 1337) convert to 1337-speak rev) reverse the string quit) exit the program Please enter a string: Hello CS 200. Action (1337, rev, quit): rev .002 SC olleH Action (1337, rev, quit): reverse again Unrecognized action. .002 SC olleH Action (1337, rev, quit): rev Hello CS 200. Action (1337, rev, quit): quit See you next time! 

All input is followed by a newline, resulting in the next prompt being on the following line. The last line, "See you next time!", is also followed by a newline (Which this presentation tool removes, unfortunately.)

Write three methods: main, action1337 and actionReverse. All input and output are completed in the main method. Based on the action the user chooses, call the appropriate action method. If an unrecognized action is entered then the message "Unrecognized action." should be shown on a line by itself and then the user is prompted again just as they were when an action was performed.

 /** * 1337  convert the string to leet-speak: * Replace each L or l with a 1 (numeral one) * Replace each E or e with a 3 (numeral three) * Replace each T or t with a 7 (numeral seven) * Replace each O or o with a 0 (numeral zero) * Replace each S or s with a $ (dollar sign) * * @param current Original string * @return string converted to leet-speak. */ public static String action1337(String current) { return null; //FIX ME } /** * This reverses the order of characters in the current string. * @param current Original string to be reversed. * @return The string in reversed order. */ public static String actionReverse(String current) { return null; //FIX ME } /** * Provides the main menu for the text converter and calls methods based * on menu options chosen. * @param args */ public static void main(String[] args) { //FIX ME } 

An algorithm for the main method is:

 Show Welcome message and menu Prompt for text string Loop until "quit" Prompt for action Call appropriate action method End Loop 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago