Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  FAQFAQ  SearchSearch  RegisterRegister  MemberlistMemberlist  UsergroupsUsergroups  Log in  India NewsIndia News  
Keywords
class SYLLABUS CHEMISTRY board result 2011 PAPERS Exam maths practical java timetable MODEL 10th Results TEST 2009 computer english table question sample 2008 time programs Icse
Latest topics
» optical fibre????
Fri May 18, 2012 8:54 pm by mahnoorbloch

» physics............
Fri May 18, 2012 8:43 pm by mahnoorbloch

» magnetism...........chapter
Fri May 18, 2012 8:33 pm by mahnoorbloch

» ac generator
Fri May 18, 2012 7:46 pm by mahnoorbloch

» Great website for maths
Sun May 06, 2012 9:39 am by mahnoorbloch

» BlueJ prog
Tue Apr 24, 2012 11:53 am by arryaan

» GBTU SEE 2012 22 April
Sat Apr 21, 2012 11:17 am by shreya94

» GBTU SEE or UPTU SEE 2012 Expected cutoff marks
Sat Apr 21, 2012 11:16 am by shreya94

» GBTU SEE 2012 UPTU SEE 2012 Solutions Answer key discussion
Sat Apr 21, 2012 11:15 am by shreya94

Top posters
abhas
 
Anu..i luv icse...:)
 
G-7
 
siya
 
Candy
 
jOhNy
 
Apurva
 
WinRrule
 
ambili
 
saif
 



Search if you can't find it here

JAVA HELP req. in String programs -MP Sanjay

View previous topic View next topic Go down
AuthorMessage
M.P.SANJAY




PostSubject: JAVA HELP req. in String programs -MP Sanjay Sun Aug 17, 2008 9:36 am

WRITE A PROGRAM:

1) TO ACCEPT THE SENTENCE AND DISPLAY THE WORDS IN SEPARATE LINE.

2) TO ACCEPT A SENTENCE AND DISPLAY ONLY THE 3 LETTERED WORDS ON A SEPARATE LINE.

3) TO ACCEPT TWO SENTENCES AND THEN JOIN THEM.

4) TO ACCEPT A WORD AND THEN REVERSE THE LETTERS.

5) TO ACCEPT A SENTENCE AND REPLACE 'THE' WITH 'AN'.


PLEASE SEND IT AS FAST AS POSSIBLE
Back to top Go down
View user profile
abhas
Active member
Active member



PostSubject: Re: JAVA HELP req. in String programs -MP Sanjay Tue Aug 19, 2008 5:34 pm

import java.io.*;
class str1
{
public static void main(String args[]) throws IOException
{
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter sentence");
String s=obj.readLine();
s=s.trim();
for(int a=0;a<s.length();a++)
{

if(s.charAt(a)==' ')
System.out.println();
else
System.out.print(s.charAt(a));

}

}
}



this is 1stone i will answer others soon ................

please wait,,,,,,,,
Back to top Go down
View user profile
abhas
Active member
Active member



PostSubject: Re: JAVA HELP req. in String programs -MP Sanjay Mon Aug 25, 2008 8:01 pm

3rd one is very very easy
import java.io.*;
class str1
{
public static void main(String args[]) throws IOException
{
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter sentence");
String s=obj.readLine();

System.out.println("Enter sentence");
String s2=obj.readLine();

String s3=s1 s2; //or String s3=s1 " " s2; if u want to add space
System.out.println(s3);

}
}
Back to top Go down
View user profile
abhas
Active member
Active member



PostSubject: Re: JAVA HELP req. in String programs -MP Sanjay Mon Aug 25, 2008 8:06 pm

if u are having any prob. in logic of any of these program then please post ur incorrect progs. here and i will try to correct them it would be better....


its diff. for me to type each program and give it to u..

i may debug ur progs.
Back to top Go down
View user profile
abhas
Active member
Active member



PostSubject: Re: JAVA HELP req. in String programs -MP Sanjay Thu Aug 28, 2008 4:56 pm

4) TO ACCEPT A WORD AND THEN REVERSE THE LETTERS.
public class stringr
{
void main(String check)

{
int a = check.length();

for (int c=a-1;c>=0;c--)
{

System.out.print(check.charAt(c));
ch=ch+1;

}

}
}
Back to top Go down
View user profile
akshay
Active member
Active member



PostSubject: Re: JAVA HELP req. in String programs -MP Sanjay Wed Feb 18, 2009 7:13 am

5th one is extremely short:

import java.io.*;
class strings
{
public static void main() throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter a sentence");
String s=in.readLine();
s= s.replace("the","an");
System.out.println(s);
}
}
Back to top Go down
View user profile
akshay
Active member
Active member



PostSubject: Re: JAVA HELP req. in String programs -MP Sanjay Wed Feb 18, 2009 7:13 am

here's the 2nd one also:
import java.io.*;
class threeletterword
{
public static void main() throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter a sentence");
String s=in.readLine();
s=s.trim();
s=s+" ";
int len=s.length();
int len1,k,count;
String word= new String();
for (int i=0;i<len;i++)
{
k=s.indexOf(" ",i);
word=s.substring(i,k);
len1=word.length();
if (len1==3)
System.out.println(word);
i=k;
}}}

=)
Back to top Go down
View user profile
agentp.1994




PostSubject: hey!here is the 4th one... Fri Nov 06, 2009 7:19 pm

class abc
{
void getname(String s1)
{
String s3="";
for(int i=s1.length-1;i>=0;i--)
{
char ch =s1.charAt(i);
s3=s3+ch;
}
System.out.print(s3);
}

}
eg:life
=efil..
Back to top Go down
View user profile

JAVA HELP req. in String programs -MP Sanjay

View previous topic View next topic Back to top
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: Computer :: Computer help forum-