FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programs/student2.java at main · VirajPatidar/Java-Programs · GitHub
VirajPatidar
/
Java-Programs
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programs
/
student2.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (27 loc) · 983 Bytes
Breadcrumbs
Java-Programs
/
student2.java
Copy path
File metadata and controls
27 lines (27 loc) · 983 Bytes
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
import
java
.
util
.
Scanner
;
public
class
student2
{
int
rollNo
;
int
total
=
0
;
double
percentage
;
String
Name
;
static
Scanner
sc
=
new
Scanner
(
System
.
in
);
void
getInfo
(){
System
.
out
.
println
(
"Enter student roll number, Name, and PCMBE Marks in order"
);
rollNo
=
Integer
.
parseInt
(
sc
.
nextLine
());
Name
=
sc
.
nextLine
();
for
(
int
i
=
1
;
i
<=
5
;
i
++)
total
+=
Integer
.
parseInt
(
sc
.
nextLine
());
}
void
calcPercentage
(
int
totalMarks
){
percentage
= (
double
)
totalMarks
/
500
*
100
;
}
void
display
(){
System
.
out
.
println
(
"------------------------"
);
System
.
out
.
println
(
"Name: "
+
Name
+
"
\n
Roll Number: "
+
rollNo
+
"
\n
TotalMarks: "
+
total
+
"
\n
Percentage score: "
+
percentage
);
System
.
out
.
println
(
"------------------------"
);
}
public
static
void
main
(
String
[]
args
) {
student2
s1
=
new
student2
();
s1
.
getInfo
();
s1
.
calcPercentage
(
s1
.
total
);
s1
.
display
();
sc
.
close
();
}
}
Back
|
FazBrowse Home
|
New Git URL