swers? Start searching... Search A VitalSource x d VitalSource x O VitalSource x * Programmi x 9 06 Boyle's x 6 06 Boyle's LX em/#/books/9781119321071/cfi/6/354!/4/2@0.00:100 Tp A G 21 return resuLt.reptace( ,; 22 23 24 /** Finds the next unescaped symbol. @param message a message with Wiki markup @param symbols the symbols to search for @param start the starting position for the search @return the position of the next markup symbol at or after start */ public static int nextSymbol (String message, String symbols, int start) 26 27 28 /** 37 Gets the HTML tag for a markup symbol. @param symbol the markup symbol @return the corresponding HTML tag, or null if none found */ public static String tagForSymbol(char symbol) 38 39 40 41 42 if (symbol == '!') { return "em"; } else if (symbol == *) { return "strong"; } else if (symbol == ') { return "code"; } else if (symbol == '^). { return "super"; } else if (symbol == else { return null; } 43 44 45 46 47 48 49 50 ') { return "sub"; } 51 /** Replaces a character of a string at a given position. @param str the string where the replacement takes place @param position the position of the character to be replaced @param replacement the replacement string, or the original string if position was not valid. 52 53 54 56 57 G 近 rers? Start searching... SPTED Search 1 VitalSource Xx d VitalSource X d VitalSource x * Programmi x O 06 Boyle's LX 6 06 Boyle's x /#/books/9781119321071/cfi/6/354!/4/2@0.00:100 Start over ... 9. In the preceding exercises, you saw how one can use stepwise refinement to solve the problem of translating Wiki markup to HTML. Now turn the pseudocode into code. Complete the convertToHTML and nextSymbol methods in the following class. WikiMarkup.java 1 import java.util.Scanner; 3 public class WwikiMarkup 4 { public static void main(String[] args) { 7. 5 6. Scanner in = new Scanner (System.in); String message = in.nextLine(); System.out.println(convertToHTML (message)); } 8 9 10 11 12 13 /** Converts a message with Wiki markup to HTML. @param message the message with markup @return the message with Wiki notation converted to HTML 14 15 16 17 18 19 20 21 22 23 24 25 public static String convertToHTML (String message) String result = message; return result.replace("\\", ""); /** Finds the next unescaped symbol. L ---l Show all 8:06 PM G 11/1/2020 prt sc 40

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
swers? Start searching...
Search
A VitalSource x
d VitalSource x
O VitalSource x
* Programmi x
9 06 Boyle's x
6 06 Boyle's LX
em/#/books/9781119321071/cfi/6/354!/4/2@0.00:100
Tp A G
21
return resuLt.reptace( ,;
22
23
24
/**
Finds the next unescaped symbol.
@param message a message with Wiki markup
@param symbols the symbols to search for
@param start the starting position for the search
@return the position of the next markup symbol at or after start
*/
public static int nextSymbol (String message, String symbols, int start)
26
27
28
/**
37
Gets the HTML tag for a markup symbol.
@param symbol the markup symbol
@return the corresponding HTML tag, or null if none found
*/
public static String tagForSymbol(char symbol)
38
39
40
41
42
if (symbol == '!') { return "em"; }
else if (symbol == *) { return "strong"; }
else if (symbol == ') { return "code"; }
else if (symbol == '^). { return "super"; }
else if (symbol ==
else { return null; }
43
44
45
46
47
48
49
50
') { return "sub"; }
51
/**
Replaces a character of a string at a given position.
@param str the string where the replacement takes place
@param position the position of the character to be replaced
@param replacement the replacement string, or the original string
if position was not valid.
52
53
54
56
57
G
近
Transcribed Image Text:swers? Start searching... Search A VitalSource x d VitalSource x O VitalSource x * Programmi x 9 06 Boyle's x 6 06 Boyle's LX em/#/books/9781119321071/cfi/6/354!/4/2@0.00:100 Tp A G 21 return resuLt.reptace( ,; 22 23 24 /** Finds the next unescaped symbol. @param message a message with Wiki markup @param symbols the symbols to search for @param start the starting position for the search @return the position of the next markup symbol at or after start */ public static int nextSymbol (String message, String symbols, int start) 26 27 28 /** 37 Gets the HTML tag for a markup symbol. @param symbol the markup symbol @return the corresponding HTML tag, or null if none found */ public static String tagForSymbol(char symbol) 38 39 40 41 42 if (symbol == '!') { return "em"; } else if (symbol == *) { return "strong"; } else if (symbol == ') { return "code"; } else if (symbol == '^). { return "super"; } else if (symbol == else { return null; } 43 44 45 46 47 48 49 50 ') { return "sub"; } 51 /** Replaces a character of a string at a given position. @param str the string where the replacement takes place @param position the position of the character to be replaced @param replacement the replacement string, or the original string if position was not valid. 52 53 54 56 57 G 近
rers? Start searching...
SPTED
Search
1
VitalSource Xx
d VitalSource X
d VitalSource x
* Programmi x
O 06 Boyle's LX
6 06 Boyle's x
/#/books/9781119321071/cfi/6/354!/4/2@0.00:100
Start over
... 9. In the preceding exercises, you saw how one can use stepwise refinement to solve the problem of translating Wiki markup to HTML.
Now turn the pseudocode into code. Complete the convertToHTML and nextSymbol methods in the following class.
WikiMarkup.java
1 import java.util.Scanner;
3 public class WwikiMarkup
4 {
public static void main(String[] args)
{
7.
5
6.
Scanner in = new Scanner (System.in);
String message = in.nextLine();
System.out.println(convertToHTML (message));
}
8
9
10
11
12
13
/**
Converts a message with Wiki markup to HTML.
@param message the message with markup
@return the message with Wiki notation converted to HTML
14
15
16
17
18
19
20
21
22
23
24
25
public static String convertToHTML (String message)
String result = message;
return result.replace("\\", "");
/**
Finds the next unescaped symbol.
L ---l
Show all
8:06 PM
G
11/1/2020
prt sc
40
Transcribed Image Text:rers? Start searching... SPTED Search 1 VitalSource Xx d VitalSource X d VitalSource x * Programmi x O 06 Boyle's LX 6 06 Boyle's x /#/books/9781119321071/cfi/6/354!/4/2@0.00:100 Start over ... 9. In the preceding exercises, you saw how one can use stepwise refinement to solve the problem of translating Wiki markup to HTML. Now turn the pseudocode into code. Complete the convertToHTML and nextSymbol methods in the following class. WikiMarkup.java 1 import java.util.Scanner; 3 public class WwikiMarkup 4 { public static void main(String[] args) { 7. 5 6. Scanner in = new Scanner (System.in); String message = in.nextLine(); System.out.println(convertToHTML (message)); } 8 9 10 11 12 13 /** Converts a message with Wiki markup to HTML. @param message the message with markup @return the message with Wiki notation converted to HTML 14 15 16 17 18 19 20 21 22 23 24 25 public static String convertToHTML (String message) String result = message; return result.replace("\\", ""); /** Finds the next unescaped symbol. L ---l Show all 8:06 PM G 11/1/2020 prt sc 40
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education