-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentDC.java
More file actions
64 lines (50 loc) · 1.33 KB
/
Copy pathStudentDC.java
File metadata and controls
64 lines (50 loc) · 1.33 KB
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
// can dilikoglu
// 00463308
// this assignment is completed in my room
// this is the student class. In this class, attributes and methods will be created in order to use in the driver program
public class StudentDC
{
private String name;
private String major;
private String classification;
private float gpa;
public StudentDC(String n , String m , String c , float g) // constructor which accepts parameters
{ name = n;
major = m;
classification = c;
gpa = g;
}
public StudentDC() // no-arg constructor
{ name="no";
major="no";
classification="no";
gpa=0;
}
public void setName(String n) // mutator method for name
{ name = n;
}
public void changeMajor( String m) // mutator method for major
{ major=m;
}
public void updateClassification( String c) // mutator method for classification
{ classification = c;
}
public void setGPA( float g) // mutator method for gpa
{ gpa = g ;
}
public String getName()
{ return name;
}
public String getMajor()
{ return major;
}
public String getClassification()
{ return classification;
}
public float getGPA()
{ return gpa;
}
public float calculateGPA(float scoreC1, float scoreC2, float scoreC3, float scoreC4, float scoreC5) // calculater method, calculates gpa
{ return 3*scoreC1+3*scoreC2+3*scoreC3+(4*scoreC4)+(2*scoreC5))/15;
}
}