FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-backup/5th_sem_C_Java_VB/Java/File_Handling/q13.java at master · Jimut123/code-backup · GitHub
This repository was archived by the owner on Jul 28, 2024. It is now read-only.
Jimut123
/
code-backup
Public archive
Notifications
You must be signed in to change notification settings
Fork
6
Star
20
Code
Issues
0
Pull requests
35
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
code-backup
/
5th_sem_C_Java_VB
/
Java
/
File_Handling
/
q13.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
68 lines (39 loc) · 1.28 KB
Breadcrumbs
code-backup
/
5th_sem_C_Java_VB
/
Java
/
File_Handling
/
q13.java
Copy path
File metadata and controls
68 lines (39 loc) · 1.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*Write a java program to calculate and print
(i) number of vowels
(ii) number of consonants
(iii) Number of lines
(iv) number of spaces in any text file.*/
import
java
.
io
.*;
class
q13
{
public
static
void
main
(
String
args
[])
throws
IOException
{
String
file1
;
int
ch
,
nol
,
ns
,
v
,
c
;
nol
=
1
;
ns
=
v
=
c
=
0
;
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
System
.
out
.
print
(
"
\n
Enter Input File Name = "
);
file1
=
br
.
readLine
();
FileInputStream
fp1
=
new
FileInputStream
(
file1
);
while
((
ch
=
fp1
.
read
())!=-
1
)
{
if
(
ch
==
10
)
nol
=
nol
+
1
;
else
if
(
ch
==
32
)
ns
=
ns
+
1
;
else
if
((
ch
>=
65
&&
ch
<=
90
) || (
ch
>=
97
&&
ch
<=
122
))
{
if
(
ch
==
'A'
||
ch
==
'E'
||
ch
==
'I'
||
ch
==
'O'
||
ch
==
'U'
||
ch
==
'a'
||
ch
==
'e'
||
ch
==
'i'
||
ch
==
'o'
||
ch
==
'u'
)
v
=
v
+
1
;
else
c
=
c
+
1
;
}
}
System
.
out
.
println
(
"Number of Vowels = "
+
v
);
System
.
out
.
println
(
"Number of Consonants = "
+
c
);
System
.
out
.
println
(
"Number of lines = "
+
nol
);
System
.
out
.
println
(
"Number of spaces = "
+
ns
);
fp1
.
close
();
}
}
Back
|
FazBrowse Home
|
New Git URL