write a program using string functions for class X
Attachments:
Answers
Answered by
1
import java.scanner.*;
class string
{
public static void main (String args[])
{
Scanner SC =new Scanner(System.in);
String s, s1="";
int l, i;
char c;
System.out.println("Enter a word") ;
s=SC.next()
l=s.length();
for (i=0;i<l;i++)
{
c =s.charAt(i);
if(Character.isUpperCase(c))
{
s1=s1+Character.toLowerCase(c);
}
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
{
if(c! ='z')
{
s1=s1+(char)(c+1);
}
else
{
s1=s1+"a";
}
}
}
System.out.println("New word : "+s1);
}
}
class string
{
public static void main (String args[])
{
Scanner SC =new Scanner(System.in);
String s, s1="";
int l, i;
char c;
System.out.println("Enter a word") ;
s=SC.next()
l=s.length();
for (i=0;i<l;i++)
{
c =s.charAt(i);
if(Character.isUpperCase(c))
{
s1=s1+Character.toLowerCase(c);
}
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
{
if(c! ='z')
{
s1=s1+(char)(c+1);
}
else
{
s1=s1+"a";
}
}
}
System.out.println("New word : "+s1);
}
}
alishakhan:
can you do it with scanner class
Answered by
2
Explanation:
gud night
sweet dreams...
Similar questions