I am having trouble with this:  Implement the convertString method based on its specification. Here are some things that can help: the Character class has some utility methods to determine if a character is uppercase, lowercase, or a digit (numeral) the String class has a method to get the character at a specific position (called the index). Find that method and use it. make use of the convert methods you already have! convertString Specification:  /**      * Converts the letters and numerals in the given string      * to their circled counterparts. All other characters      * are unchanged.      *       * @precondition text != null      * @postcondition none      *       * @param text the text to convert      * @return a modified version of text, with all letters and numerals      * circled.      */ My code:  public class CircleStrings {     /**      * Converts the letters and numerals in the given string      * to their circled counterparts. All other characters      * are unchanged.      *       * @precondition text != null      * @postcondition none      *       * @param text the text to convert      * @return a modified version of text, with all letters and numerals      * circled.      */     public static String convertString(String text) {         // replace the return statement with your solution         return "";     }          /**      * Converts an uppercase letter to its circled counterpart.      *       * @precondition 'A' <= letter <= 'Z'      * @postcondition none      *       * @param letter the uppercase letter to convert      * @return the circled version of the uppercase letter      */     public static char convertUppercaseLetter(char letter) {         if (letter < 'A' || letter > 'Z') {             throw new IllegalArgumentException("letter must be uppercase");         }         return (char)(letter + 9333);     }          /**      * Converts a lowercase letter to its circled counterpart.      *       * @precondition 'a' <= letter <= 'a'      * @postcondition none      *       * @param letter the lowercase letter to convert      * @return the circled version of the lowercase letter      */     public static char convertLowercaseLetter(char letter) {         if (letter < 'a' || letter > 'z') {             throw new IllegalArgumentException("letter must be lowercase");         }         return (char)(letter + 9327);     }          /**      * Converts a numeral character to its circled counterpart.      *       * @precondition '0' <= letter <= '9'      * @postcondition none      *       * @param numeral the numeral to convert      * @return the circled version of the numeral      */     public static char convertNumeral(char numeral) {         if (numeral < '0' || numeral > '9') {             throw new IllegalArgumentException("numeral must be between '0' and '9' inclusive");         }         if (numeral == '0') {             return (char)(numeral + 9402);         }                  return (char)(numeral + 9263);     } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I am having trouble with this: 

  1. Implement the convertString method based on its specification. Here are some things that can help:
    1. the Character class has some utility methods to determine if a character is uppercase, lowercase, or a digit (numeral)
    2. the String class has a method to get the character at a specific position (called the index). Find that method and use it.
    3. make use of the convert methods you already have!

      convertString Specification: 
      /**
           * Converts the letters and numerals in the given string
           * to their circled counterparts. All other characters
           * are unchanged.
           * 
           * @precondition text != null
           * @postcondition none
           * 
           * @param text the text to convert
           * @return a modified version of text, with all letters and numerals
           * circled.
           */

      My code: 

      public class CircleStrings {

          /**
           * Converts the letters and numerals in the given string
           * to their circled counterparts. All other characters
           * are unchanged.
           * 
           * @precondition text != null
           * @postcondition none
           * 
           * @param text the text to convert
           * @return a modified version of text, with all letters and numerals
           * circled.
           */
          public static String convertString(String text) {
              // replace the return statement with your solution
              return "";
          }
          
          /**
           * Converts an uppercase letter to its circled counterpart.
           * 
           * @precondition 'A' <= letter <= 'Z'
           * @postcondition none
           * 
           * @param letter the uppercase letter to convert
           * @return the circled version of the uppercase letter
           */
          public static char convertUppercaseLetter(char letter) {
              if (letter < 'A' || letter > 'Z') {
                  throw new IllegalArgumentException("letter must be uppercase");
              }
              return (char)(letter + 9333);
          }
          
          /**
           * Converts a lowercase letter to its circled counterpart.
           * 
           * @precondition 'a' <= letter <= 'a'
           * @postcondition none
           * 
           * @param letter the lowercase letter to convert
           * @return the circled version of the lowercase letter
           */
          public static char convertLowercaseLetter(char letter) {
              if (letter < 'a' || letter > 'z') {
                  throw new IllegalArgumentException("letter must be lowercase");
              }
              return (char)(letter + 9327);
          }
          
          /**
           * Converts a numeral character to its circled counterpart.
           * 
           * @precondition '0' <= letter <= '9'
           * @postcondition none
           * 
           * @param numeral the numeral to convert
           * @return the circled version of the numeral
           */
          public static char convertNumeral(char numeral) {
              if (numeral < '0' || numeral > '9') {
                  throw new IllegalArgumentException("numeral must be between '0' and '9' inclusive");
              }
              if (numeral == '0') {
                  return (char)(numeral + 9402);
              }
              
              return (char)(numeral + 9263);
          }
      }



Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Fibonacci algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY