-
Notifications
You must be signed in to change notification settings - Fork 1
/
ReportCard.java
84 lines (65 loc) · 2.04 KB
/
ReportCard.java
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.example.hp.reportclass;
public class ReportCard extends Student {
String name;
char englishGrade;
String mathGrade;
int historyGrade;
double biologyGrade;
public ReportCard() {
name = "Anu";
englishGrade = 'A';
mathGrade = "A-";
historyGrade = 85;
biologyGrade = 90.5;
}
String Grades[] = new String[20];// a string array to score different subject grades of student
public String getName() //getting eng subject marks of student
{
return name;
}
public void setName(String name)//setting eng subject marks of student
{
name = "Anusha";
}
public char getEnglishGrade()//getting eng subject marks of student
{
return englishGrade;
}
public void setEnglishGrade()//setting eng subject marks of student
{
englishGrade = 'B';
}
public String getMathGrade()//getting maths subject marks of student
{
return mathGrade;
}
public void setMathGrade()//setting maths subject marks of student
{
mathGrade = "A+";
}
public int getHistoryGrade()//getting history subject marks of student
{
return historyGrade;
}
public void setHistoryGrade()//setting history subject marks of student
{
historyGrade = 88;
}
public double getBiologyGrade()//getting biology subject marks of student
{
return biologyGrade;
}
public void setBiologyGrade()//setting bio subject marks of student
{
biologyGrade = 95.8;
}
@Override
public String toString() {
return ("Name:" + getName() + "; English grade:" + getEnglishGrade() + " History grade: " + getHistoryGrade() + "; Math grade:" + mathGrade + "Biology grade:" + getBiologyGrade());
}
public static void main(String args[]) {
ReportCard r = new ReportCard();
String abc = r.toString();
System.out.print(abc);
}
}