Question
Introduction to Java Programming The Java program(s) from this assignment will: 1. Help gain familiarity with Character and String Classes and some of their commonly
Introduction to Java Programming
The Java program(s) from this assignment will: 1. Help gain familiarity with Character and String Classes and some of their commonly used functions 2. Enhance skills in printing formatted strings 3. Set the stage for the use of Looping construct(s) to process collections of objects, such as Strings, that really are collection of characters
In this section you will write a program named ProcessString, that will read a string, evaluate characters it contains and build a final string based on a set of rules
(a) Ask the user to enter a legitimate English word with a minimum of 5 and a maximum of 7 characters (b) Process the user entered string and return the updated version of that string applying the following rules: (i) Read the first 2 characters and keep them if they are p and a, in that order (ii) Keep the fourth character if it is a e (iii) Change the first and last characters of the resulting (final) string to an uppercase (iv) Print the resulting string to the standard out using the Tab escape character (\t) to format the output, as shown in sample below. Please use sample only as reference, do not use the string(s) in sample Note: 1. If user enters a string longer than 7 or shorter than 5, tell the user whether the string was too long or too short. Do not process wrong-sized string, and the program should end with the error note. We will go over repetitive processing after the discussion on Looping constructs and custom methods in the next class session. 2. Ignore cases of characters. In other words, for this program, consider P and p as equal, and so, strings parent and PaRent should produce the same result
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started