Concept explainers
Explanation of Solution
Program code:
Test.java
//import the required packages
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.io.PrintStream;
//define a class Test
public class Test
{
//define a method leetSpeak
public static void leetSpeak(Scanner input, PrintStream output)
{
//iterate a while loop to get the lines
while(input.hasNextLine())
{
//declare a Scanner object
Scanner line = new Scanner(input.nextLine());
//iterate a while loop
while (line.hasNext())
{
//get the tokens to word
String word = line.next();
//replace the letters with numbers
word = word.replace("o", "0");
word = word.replace("l", "1");
word = word.replace("e", "3");
word = word.replace("a", "4");
word = word.replace("t", "7");
int n = word.length();
//if the condition is true
if (word.charAt(n-1) == 's')
{
//create the substrings
word = word...
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Building Java Programs: A Back To Basics Approach, Loose Leaf Edition (5th Edition)
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education