Create a JSP page to accept a number from an user and display it in words: Example: 123 – One Two Three. The output should be in red color.

NumberWord.html

<html>
<body>
<form method=get action="NumberWord.jsp">
Enter Any Number : <input type=text name=num><br><br>
<input type=submit value="Display">
</form>
<body>
</html>

NumberWord.jsp

<html>
<body>
<font color=red>
<%! int i,n;
       String s1;
%>
<%   s1=request.getParameter("num");
         n=s1.length();
         i=0;
         do
         {
           char ch=s1.charAt(i);
           switch(ch)
            {
                case '0': out.println("Zero  ");break;
                case '1': out.println("One  ");break;
                case '2': out.println("Two  ");break;
                case '3': out.println("Three  ");break;
                case '4': out.println("Four ");break;
                case '5': out.println("Five  ");break;
               case '6': out.println("Six  ");break;
               case '7': out.println("Seven  ");break;
               case '8': out.println("Eight  ");break;
               case '9': out.println("Nine  ");break;
           }
           i++;
         }while(i<n);
%>
</font>
</body>
</html>

Comments

  1. The main motive of the Big data service providers is to spread the knowledge so that they can give more big data engineers to the world.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete

Post a Comment

Popular posts from this blog

Write a java program to create Teacher table(TNo.TName, Sal, Desg) and insert a record in it.

Write a JSP program to accept the details of Account (ANo, Type, Bal) and store it into database and display it in tabular form. (Use PreparedStatement interface)