do the following

do the following

write a program to enter the string and do the following 1- count totle number of vowel 2- replace vowel 3- delete the charactor from given value 4- riverce the string 5- convert second word in upercase 6- convert third word in lowercase

View Answers

June 12, 2013 at 4:48 PM

hi friend,

Try the following code, may this will be helpful for you

index.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
<head>
<title>Index Page Example</title>
</head>
<body>
<table>
<tr>
<td><h:link value="Get No Of Vowels" outcome="vowel" /></td>
</tr>
<tr>
<td><h:link value="Get Reverse String" outcome="reverse" /></td>
</tr>
<tr>
<td><h:link value="Change Character In Upper Case" outcome="upperText" /></td>
</tr>
<tr>
<td><h:link value="Change Character In Lower Case" outcome="lowerText" /></td>
</tr>
<tr>
<td><h:link value="Delete Character" outcome="delete" /></td>
</tr>
</table>
</body>
</html>

Continue...


June 12, 2013 at 4:49 PM

vowel.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<title>Count Vowel Example</title>
</h:head>
<h:body>
<h1>JSF Example</h1>
<h:form id="form1">
<table>
<tr>
<td>Enter String To Check Vowel : </td>
<td><h:inputText id="nameText" value="#{vowel.str}" required="true" requiredMessage="Field Mustn't Be Empty" tabindex="5" maxlength="15" accesskey="t"/></td>
<td><h:message for="nameText" style="color:red" /></td>
</tr>
<tr>
<td>Total No Of Vowels Are : </td>
<td><h:outputText value="#{vowel.count}"/></td>
</tr>
<tr>
<td><h:commandButton value="Get Vowel Count" action="#{vowel.getVowel(vowel.str)}" /></td>
</tr>
</table>
</h:form>
</h:body>
</html>

Continue...


June 12, 2013 at 4:50 PM

reverse.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<title>Reverse String Example</title>
</h:head>
<h:body>
<h1>JSF Example</h1>
<h:form id="form1">
<table>
<tr>
<td>Enter A String To Reverse : </td>
<td><h:inputText id="text1" value="#{vowel.str}" required="true" requiredMessage="Field Mustn't Be Empty" tabindex="5" maxlength="15"/></td>
<td><h:message for="text1" style="color:red" /></td>
</tr>
<tr>
<td>New String After Reverse : </td>
<td><h:outputText value="#{vowel.revString}"/></td>
</tr>
<tr>
<td><h:commandButton value="Reverse Value" action="#{vowel.reverseString(vowel.str)}" /></td>
</tr>
</table>
</h:form>
</h:body>
</html>

Continue...


June 12, 2013 at 4:52 PM

upperText.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<title>Upper Text Example</title>
</h:head>
<h:body>
<h1>JSF Example</h1>
<h:form id="form1">
<table>
<tr>
<td>Enter A String To Convert In Upper Case 
<table>
<tr>
<td>(Second Word Should Be In Lower Case)</td>
</tr>
</table>
</td>
<td><h:inputText id="text1" value="#{vowel.str}" required="true" requiredMessage="Field Mustn't Be Empty" tabindex="5" maxlength="15"/></td>
<td><h:message for="text1" style="color:red" /></td>
</tr>
<tr>
<td>New String In Upper Case : </td>
<td><h:outputText value="#{vowel.strUpper}"/></td>
</tr>
<tr>
<td><h:commandButton value="Get Upper" action="#{vowel.upper(vowel.str)}" /></td>
</tr>
</table>
</h:form>
</h:body>
</html>

Continue...


June 12, 2013 at 4:58 PM

lowerText.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<title>Lower Text Example</title>
</h:head>
<h:body>
<h1>JSF Example</h1>
<h:form id="form1">
<table>
<tr>
<td>Enter A String To Convert In Lower Case 
<table>
<tr>
<td>(Third Word Should Be In Upper Case)</td>
</tr>
</table>
</td>
<td><h:inputText id="text1" value="#{vowel.str}" required="true" requiredMessage="Field Mustn't Be Empty" tabindex="5" maxlength="15"/></td>
<td><h:message for="text1" style="color:red" /></td>
</tr>
<tr>
<td>New String In Lower Case : </td>
<td><h:outputText value="#{vowel.strLower}"/></td>
</tr>
<tr>
<td><h:commandButton value="Get Lower" action="#{vowel.lower(vowel.str)}" /></td>
</tr>
</table>
</h:form>
</h:body>
</html>

Continue...


June 12, 2013 at 5:00 PM

delete.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<title>Delete Character Example</title>
</h:head>
<h:body>
<h1>JSF Example</h1>
<h:form id="form1">
<table>
<tr>
<td>Enter A String : </td>
<td><h:inputText id="text2" value="#{vowel.str}" required="true" requiredMessage="Field Mustn't Be Empty" tabindex="5" maxlength="15"/></td>
<td><h:message for="text2" style="color:red" /></td>
</tr>
<tr>
<td>Enter Character To Delete : </td>
<td><h:inputText id="text1" value="#{vowel.ch1}" required="true" requiredMessage="Field Mustn't Be Empty" tabindex="5" maxlength="15" accesskey="c"/></td>
<td><h:message for="text1" style="color:red" /></td>
</tr>
<tr>
<td>New String After Delete</td>
<td><h:outputText value="#{vowel.str1}"/></td>
</tr>
<tr>
<td><h:commandButton value="Delete Character" action="#{vowel.deleteChar(vowel.ch1)}" /></td>
</tr>
</table>
</h:form>
</h:body>
</html>

Continue...


June 12, 2013 at 5:01 PM

FindVowel.java

package devmanuals;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name="vowel")
@RequestScoped
public class FindVowel {

    String str, str1, revString="", strUpper="", strLower="";

    int count=0;
    char ch;
    char ch1, ch2;

    public String getStrLower() {
        return strLower;
    }

    public String getStrUpper() {
        return strUpper;
    }

    public String getRevString() {
        return revString;
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        this.str = str;
    }

    public int getCount()
    {
        return count;
    }

    public String getStr1()
    {
        return str1;
    }

    public char getCh1() {
        return ch1;
    }

    public void setCh1(char ch1) {
        this.ch1 = ch1;
    }

    public void lower(String str2)
    {
        //String newString="";
        StringBuffer sb = new StringBuffer();
        for(int i=0; i < str2.length(); i++)
        {
            //System.out.println(i+" "+str2.charAt(i));
            //str2.charAt(i);
            if(i < 2)
            {
            sb.append(str2.charAt(i));
            }
            if(i==2)
            {
                char c = str2.charAt(i);
                String u = Character.toString(c);
                sb.append(u.toLowerCase());             
            }
            if(i > 2)
            {
                sb.append(str2.charAt(i));
            }
        }
        strLower = sb.toString();       
    }   

    public void upper(String str2)
    {
        //String newString="";
        StringBuffer sb = new StringBuffer();
        for(int i=0; i < str2.length(); i++)
        {
            //System.out.println(i+" "+str2.charAt(i));
            //str2.charAt(i);
            if(i < 1)
            {
            sb.append(str2.charAt(i));
            }
            if(i==1)
            {
                char c = str2.charAt(i);
                String u = Character.toString(c);
                sb.append(u.toUpperCase());             
            }
            if(i > 1)
            {
                sb.append(str2.charAt(i));
            }
        }
        strUpper = sb.toString();       
    }

    public void reverseString(String str2)
    {       
        for(int i=str2.length()-1; i >= 0; i--)
        {
            revString = revString+str2.charAt(i);           
        }       
    }

    public void deleteChar(char c)
    {
        if(c != 0)
        {
            for(int i=0; i< str.length(); i++)
            {
                ch2 = str.charAt(i);
                if(c == ch2)
                {
                    str1 = str.replace(""+c, "");
                }
            }
        }       
    }

    public void getVowel(String text)
    {       
        if(text != null)
        {                   
            for(int i = 0; i< text.length(); i++)
            {
                ch = text.charAt(i);
                if(ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' ||
                    ch == 'I' || ch == 'o' || ch == 'O' || ch == 'u' || ch == 'U')
                {
                    count++;
                }
            }       
        }
    }   
}

Thanks.









Related Tutorials/Questions & Answers:
do the following
do the following  write a program to enter the string and do the following 1- count totle number of vowel 2- replace vowel 3- delete the charactor from given value 4- riverce the string 5- convert second word in upercase 6
Write a program named InternetCharge_YourLastName that do the following:
Write a program named InternetCharge_YourLastName that do the following: ..._YourLastName that do the following: *display the menu as follow: 1. Package A 2... the total charge in the following format. The total charge will include the tax 8.5
Advertisements
The while and do
While and do-while      ... a particular condition is true. To write a while statement use the following form... terminates. Have a look at do-while statement now. ADS_TO_REPLACE_3 Here
how to do this?
how to do this?   Given any integer 2D array, design then implement a Java program that will add to each element in the array the corresponding... and after modification. For example, if the program fed with following 2D array
ModuleNotFoundError: No module named 'do'
ModuleNotFoundError: No module named 'do'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... library. You can install do python with following command: pip install do
write following program
write following program  Q1 What is the difference between single threaded application and multithreaded application? What are the benefits of multi...? (adsbygoogle = window.adsbygoogle || []).push({}); Q13 How do you add a class
source code for the following question
source code for the following question  source code for the fuzzy c-means
Print the following format
Print the following format  how to print the following format given string "00401121" in java 0-** 1-* 2-* 3- 4
Expain the following code ?
Expain the following code ?  please explain the following line of code clearly? <html:link href="user.do?parameter=create">Create User</html:link>
covert the following using java
covert the following using java  how to convert (for eg : 2.89) . this decimal to binary in java
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
print the following series
print the following series  a b c d e b c d e c d e d e e   Hi Friend, Try the following code:ADS_TO_REPLACE_1 class StringPattern { public static void main(String[] args) { String st="abcde
print array in following format
print array in following format  i want print two array in following format first array= 1,2,3,4,5,6,7,8,9 second array=11,12,13,14,15,16,17,18,19 i...; Here is a code that displays the array values in the following pattern: 1 2
how to print the following pattern
how to print the following pattern  Hello hEllo heLlo helLo hellO pls reply soon its an emergency   class StringPattern { public static void main(String[] args) { String st="hello
C program to print the following
C program to print the following  Hello, Some one help me with a "C Program" to print the following as output: 4444444 4333334 4322234 4321234 4322234 4333334 4444444 // for input 4. And also
How do you do data mining projects?
How do you do data mining projects?  Hi, I am beginner in Data... do you do data mining projects? Try to provide me good examples or tutorials links so that I can learn the topic "How do you do data mining projects
do-while loop
do-while loop  how many times will the following loop get executed and what will be the final value of the variable I after execution the loop is over. int I = 5; do{ I + = 3; System.out.println(""+I); I=I+1; }while(I>=9
php do while syntax
php do while syntax  How to create a do while loop in php. What is the syntax
php do while example
php do while example  Simple example of do while loop in PHP
php do while loop
php do while loop  Difference between do while loop and simple loop in PHP
ModuleNotFoundError: No module named 'pelican-do'
with following command: pip install pelican-do After the installation of pelican...ModuleNotFoundError: No module named 'pelican-do'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'sub-do'
to install padas library. You can install sub-do python with following command...ModuleNotFoundError: No module named 'sub-do'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sub
ModuleNotFoundError: No module named 'sub-do'
to install padas library. You can install sub-do python with following command...ModuleNotFoundError: No module named 'sub-do'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sub
ModuleNotFoundError: No module named 'do-audit'
ModuleNotFoundError: No module named 'do-audit'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... to install padas library. You can install do-audit python with following
ModuleNotFoundError: No module named 'do-client'
ModuleNotFoundError: No module named 'do-client'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... have to install padas library. You can install do-client python with following
ModuleNotFoundError: No module named 'do-latency'
with following command: pip install do-latency After the installation of do...ModuleNotFoundError: No module named 'do-latency'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'do-pack'
ModuleNotFoundError: No module named 'do-pack'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... to install padas library. You can install do-pack python with following command
ModuleNotFoundError: No module named 'DO_runin'
ModuleNotFoundError: No module named 'DO_runin'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'DO... to install padas library. You can install DO_runin python with following
ModuleNotFoundError: No module named 'do-utils'
ModuleNotFoundError: No module named 'do-utils'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... to install padas library. You can install do-utils python with following
ModuleNotFoundError: No module named 'do-cli'
ModuleNotFoundError: No module named 'do-cli'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... to install padas library. You can install do-cli python with following command
ModuleNotFoundError: No module named 'scrapy-do'
have to install padas library. You can install scrapy-do python with following...ModuleNotFoundError: No module named 'scrapy-do'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'sub-do'
to install padas library. You can install sub-do python with following command...ModuleNotFoundError: No module named 'sub-do'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sub
ModuleNotFoundError: No module named 'do-cli'
ModuleNotFoundError: No module named 'do-cli'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... to install padas library. You can install do-cli python with following command
ModuleNotFoundError: No module named 'do-inventorygroups'
-inventorygroups python with following command: pip install do-inventorygroups...ModuleNotFoundError: No module named 'do-inventorygroups'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'do-mpc'
ModuleNotFoundError: No module named 'do-mpc'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do... to install padas library. You can install do-mpc python with following command
ModuleNotFoundError: No module named 'do-py'
ModuleNotFoundError: No module named 'do-py'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'do-py... padas library. You can install do-py python with following command: pip
ModuleNotFoundError: No module named 'do-the-webp'
with following command: pip install do-the-webp After the installation of do...ModuleNotFoundError: No module named 'do-the-webp'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
Do data analysts code?
Do data analysts code?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Do data analysts... the topic "Do data analysts code?". Also tell me which is the good
Do data scientist code?
Do data scientist code?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Do data... the topic "Do data scientist code?". Also tell me which is the good
php do while false
php do while false   Is there any difference between FALSE and false
while and do while
while and do while  hello, What is the difference between a while statement and a do statement?   hello,ADS_TO_REPLACE_1 A while... should occur. A do statement checks at the end of a loop to see whether the next
php do while break
php do while break   receiving a Fatal saying cannot break/continue.. please suggest. Thank U
How to do url rewritting?
How to do url rewritting?  Dear Sir/Mam I have this link http://localhost:8085/call4admission/admin/home/Admin... to do?Please suggest
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
Java errors when attempting the following.
Java errors when attempting the following.  Give the java errors in attempting the following : 1) performing division operation on string value. 2) redefining base class final method in derived class. 3) defining a method
Need the Following MobileApplication Related Code
Need the Following MobileApplication Related Code  Hi, I need java coding for the following requirements in Collections.. Mobile Subscriber name: Subscriber PhonNo: Add the Subscriber: Update the Subscriber
How to print the following pattern in java?
How to print the following pattern in java?  How to print the following pattern in java? he he is he is going he is going in   import java.io.*; class StringPattern { public static void main(String[] args
core java code for following program
core java code for following program  We are hosting the Olympic... should generate the following reports a. A medal tally b. For a given country.... The following are the guidelines while writing this program Only command line based

Ads