0% found this document useful (0 votes)
108 views137 pages

ISC Computer Science Project

This document describes a program to replace all vowels in a string with asterisks (*). It takes a string as input, then loops through each character and replaces any vowels (a, e, i, o, u) with an asterisk. It then prints the original and modified strings. The key steps are: 1) Take input string, 2) Loop through each character, 3) Replace vowels with asterisks, 4) Print original and modified strings.

Uploaded by

Gourav Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views137 pages

ISC Computer Science Project

This document describes a program to replace all vowels in a string with asterisks (*). It takes a string as input, then loops through each character and replaces any vowels (a, e, i, o, u) with an asterisk. It then prints the original and modified strings. The key steps are: 1) Take input string, 2) Loop through each character, 3) Replace vowels with asterisks, 4) Print original and modified strings.

Uploaded by

Gourav Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 137

55 |I S C

Computer
Science
Project
P
R
O
G
R
A
M
2
2
To
Crea
te a
Stri
ng
and
Cou
ntN
umb
er of
Vo
wels
and
Cons
ona
nts
ALG
ORIT
HM
STEP 1 -
STARTSTEP 2
-a
= "Computer
Applications"S
TEP 3 - z =
a.length()STEP
4 - x= 0 , b=
0STEP 5 -
FROM y =0
to y<z
REPEAT
STEP 6
STEP 6 - IF
(a.charAt(y)=='a'||a.c
harAt(y)=='e'||a.char
At(y)=='i'||a.charAt(y
)=='o'||a.charAt(y)=='
u') THEN x =x
+1 OTHERWISE b =
b+1
STEP 7 -
PRINT xSTEP
8 - PRINT
bSTEP 9 –
END
sol
uti
on
import
java.io.*;class
Vowels{public
static
void main(Strin
g args[])throws
IOException//
main
function {Buffe
redReader
br=new Buffer
edReader(new
InputStreamRe
ader(System.in
));System.out.p
rintln("Enter
a string");Strin
g a=
br.readLine();/
/Accepting
string int
z=a.length(),y,x
=0,b=0;for(y=0;
y<z;y++)//loop
for counting
number of
vowels{if(a.cha
rAt(y)=='a'||a.
charAt(y)=='e'|
|a.charAt(y)=='
i'||a.charAt(y)=
='o'||a.charAt(
y)=='u')x++;else
b++;}System.ou
t.println("Numb
er of vowels
in string
="+x);//displayi
ng
result System.
out.println("Nu
mber of
consonants in
string ="+b);}}
var
i
No.
Name Type
1 br Buffere2 a
String3 z int4 y
int5 b int6 x int
out
p
56 |I S C
Comput
ble
des
cr
MethodDescrip
tion
dReadermain()
BufferedRead
er
objectm a i n ( ) i
nput
s t r i n g main()le
ngth of string
main()loop var
i a b l e main()no.
of consonant
sm a i n ( ) n o . o f
vowels

ut
er
Science
Project
ipti
o
57 |I S C
Computer
Science
Project
P
R
O
G
R
A
M
2
3
To
Crea
te a
Stri
ng
and
Cou
ntN
umb
er of
Wo
rds
ALG
ORIT
HM
STEP 1 -
STARTSTEP 2
-a
= "Computer
Applications"S
TEP 3 - z =
a.length()STEP
4 - x= 0STEP 5
- FROM y =0
to y<z
REPEAT
STEP 6STEP
6 - IF
(a.charAt(y)=='
' ) then x
=x+1STEP 7 -
PRINT
"Number
of words in
string
="+(x+1)STEP
8 – END
sol
uti
on
import
java.io.*;class
NoOfWords{pu
blic static
void main(Strin
g args[])throws
IOException{B
ufferedReader
br=new Buffer
edReader(new
InputStreamRe
ader(System.in
));System.out.p
rintln("Enter S
entence");Strin
g
a=br.readLine()
;//accepting
string System.
out.println("Th
e string is -
"+a);int
z=a.length(),y,x
=0;for(y=0;y<z;
y++)//loop for
counting
number of
spaces{if(a.cha
rAt(y)=='
')x=x+1;}Syste
m.out.println("
Number
of words in
string
="+(x+1));//disp
laying result }}
var
i
No.
Name Type
1 br Buffere2 z i
nt3 a String4 x i
nt5 y int
out
p
58 |I S C
Comput
ble
des
cr
MethodDescrip
tion
dReadermain()
BufferedRead
er
objectmain()l
ength of strin
gm a i n ( ) i n p u t
stringmain()s
pace counter
main()loop var
iable
ut
er
Science
Project
ipti
o
59 |I S C
Computer
Science
Project
P
R
O
G
R
A
M
2
4
To
crea
te a
strin
g an
d
repl
acea
ll vo
wels
with
*
ALG
ORIT
HM
STEP 1 -
STARTSTEP 2
-a
= "Computer
Applications"S
TEP 3 - x=
0STEP 4 -
FROM z =0
to z<a.length()
REPEAT
STEP 5
STEP 5 -
if(a.charAt(z)=='a'||
a.charAt(z)=='e'||a.
charAt(z)=='i'||a.ch
arAt(z)=='o'||a.char
At(z)=='u’) THEN
a.setCharAt(z,'*')
STEP 6 -
PRINT "New
String -
"+aSTEP 7 –
END
sol
uti
on
import
java.io.*;class
VowelReplace{p
ublic static
void main(Strin
g args[])throws
IOException//
main
function {Buffe
redReader
br=new Buffer
edReader(new
InputStreamRe
ader(System.in
));System.out.p
rintln(“Enter
a String”);Strin
gBuffer
a=new StringBu
ffer(br.readLin
e());//acceptin
ga
string System.
out.println("Ori
ginal String -
"+a);int
z=0;for(z=0;z<a
.length();z++)//
loop for
replacing
vowels with
"*" {if(a.charAt
(z)=='a'||a.char
At(z)=='e'||a.c
harAt(z)=='i'||
a.charAt(z)=='o
'||a.charAt(z)=
='u')a.setChar
At(z,'*');}Syst
em.out.println("
New String -
"+a);//displayin
g the result }}
var
i
No.
Name Type
1 br Buffere2 a
StringB3 z int
out
p
60 |I S C
Comput
ble
des
cr
MethodDescrip
tion
dReadermain()
BufferedRead
er
objectuffer m
ain()StringBuf
fer object of i
npum a i n ( ) l o o p
variable
ut
er
Science
Project
ipti
o
t string

You might also like