proj 2 string handling

Upload: tirthankar-datta

Post on 06-Mar-2016

227 views

Category:

Documents


0 download

DESCRIPTION

proj

TRANSCRIPT

ICSE PROJECT - 3STRING HANDLING

NAME: MADHURIMA DATTA

CLASS - X SECTION - B

ROLL NO - 12

SCHOOL: A.G. CHURCH ASANSOL

program - 3

PROGRAM 3:

WAP to

1. Accept a sentence and change the alphabets after vowels into opposite case.

2. Replace the word of your choice with a given word

VARIABLE LISTING

Serial noVariable nameVariable typeVariable description

1chcharcharacter to check vowel

2ch1charcharacter to check vowel

3lintlength

4iintloop variable

5ctrintcounter variable

6sStringstring entered

7nsStringnew string

8nsrStringnew string replaced

9wdrStringword replaced

10ewStringentered word

PROGRAM

import java.io.*;

class sentence

{

char ch,ch1;

String s,ns,nsr,wdr,ew="";

int l,i,ctr=0;

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

void show()throws IOException

{

System.out.println("Enter a sentence");

s=br.readLine();

s=s.trim();

l=s.length();

x:

for(i=0;i0)

{ctr=0;

continue x;

}

}

System.out.println();

System.out.println("enter the word to be replaced");

wdr=br.readLine();

System.out.println("enter the replacing word");

ew=br.readLine();

for(int i=0;i