Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
6th Edition
ISBN: 9781119278023
Author: Michael T. Goodrich; Roberto Tamassia; Michael H. Goldwasser
Publisher: Wiley Global Education US
bartleby

Concept explainers

Question
Book Icon
Chapter 1, Problem 9R
Program Plan Intro

Removing all the punctuations from a string

Program plan:

  • Create a class StringBuilder to remove all the punctuation stored in a string.
    • In main() function,
      • Initially, assign the original string in variable.
      • Then, invoke the removeIt()function to remove all the punctuation in a string and store the final value in original string.
      • Display the string after removing the punctuation in console screen.
    • In the method removeAt(),
      • It passes  input parameter “s” to check whether the character contains punctuation in the string. If yes, then it removes all the punctuation stored in the string “s”.
      • For loop read all the characters from a sentence until the condition leads to false.
      • Then, it calls the function ok() and check whether the character at “j” position matches with the character or not.
        • If the result returns the Boolean value false, then delete the character at the specified position in “j” otherwise store the character using Tostring() method in “s” variable.
    • In the method ok(),
      • It passes input parameter “i” to check whether the character in the sentence matches with the corresponding ASCII values.
        • If yes, then it returns the Boolean value true otherwise it return false.

Blurred answer
Students have asked these similar questions
Implement your own indexOf(String s) and lastIndexOf(String s) methods without using the built-in ones available in Java String class. Complete the following program://course: CSC190//project: Lab 12//date: (today’s date)//author: (your name)//purpose:import java.util.Scanner;class MyString {String s;   //default constructor which sets s to a null string   //your code here   //additional constructor which sets s to the string passed from the caller   //your code here   //get and set methods for s   //your code here   //return the index within s of the first occurrence of str.   //return -1 when str is not found on s.   //if s = "aabababb", s = "aba", return 1   //if s = "aabababb", s = "abaa", return -1   int indexOf(String str) {      //your code here}   //return the index within s of the last occurrence of str.   //return -1 when s is not found on str.   //if s = "aabababb", s = "aba", return 3   //if s = "aabababb", s = "abaa", return -1   int lastIndexOf(String s) {      //your…
In java can you help with parts that are missing Email- date: Date- subject: String- urgent: boolean+ Email(date:Date,urgent:boolean,subject:String)+ getDate(): Date+ setDate(date: Date): void+ getSubject(): String+ setSubject(subject:String): void+ isUrgent(): boolean+ setUrgent(urgent: boolean): void+ toString(): String public class Email {   private Date date; private String subject; privatebooleanurgent;   public Email() {   }   public Email(Date date, booleanurgent, String subject) { this.date = date; this.urgent = urgent; this.subject = subject;   }   public Date getDate() { returndate; }   publicvoid setDate(Date date) { this.date = date; }   public String getSubject() { returnsubject; }   publicvoid setSubject(String subject) { this.subject = subject; }   publicboolean isUrgent() { returnurgent; }   publicvoid setUrgent(booleanurgent) { this.urgent = urgent; }   @Override public String toString() { return"Email [date=" + date + ", subject=" + subject + ", urgent=" + urgent +…
Java

Chapter 1 Solutions

Data Structures and Algorithms in Java

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education