StringManipulator - The"StringManipulator class Program...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// The "StringManipulator" class. // Program created by: (All in Section F) // Donna Tin 463 1062 // James Chau 463 4467 // Michael Chan 461 9602 /* This program allows the user to do various functions to a string. It allows the user to enter a new string, make all of the letters uppercase, lowercase, capitalize the first letter of a word, search for a substring in a string, and reverse the string. The input by the user is the string itself, the search string for the 6th choice, and the number choice in the menu. The output is the revised string and the search locations. */ t import apsc142.*; public class StringManipulator { public static void main (String [] args) { int selection; //allows user to choose option in menu String currentStr = "Hello, World!"; //default string S StringManipulator m = new StringManipulator (); //instantiates new object S do //repeats until user chooses to quit { System.out.println ("Current String: " + currentStr); //displays current string selection = m.MenuChoice (); //reads in menu choice from method switch (selection) //loads different methods according to the choice { case 1: currentStr = m.newStr (currentStr); break; case 2: currentStr = m.uppCase (currentStr); break; case 3: currentStr = m.lowCase (currentStr); break; case 4: currentStr = m.initCaps (currentStr); break; case 5: currentStr = m.revStr (currentStr);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

StringManipulator - The"StringManipulator class Program...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online