Skip to content

Instantly share code, notes, and snippets.

@Bharathh-Raj
Last active June 7, 2021 13:54
Show Gist options
  • Save Bharathh-Raj/476ba7921df91aa405bede50bca38e64 to your computer and use it in GitHub Desktop.
Save Bharathh-Raj/476ba7921df91aa405bede50bca38e64 to your computer and use it in GitHub Desktop.
S.O.L.I.D - Single Responsibility Principle - 1
class Student{
String id;
String name;
int english;
int mathematics;
int science;
String displayAsString(){
return "Student ID:$id\nStudent Name:$name\nEnglish:$english\nMathematics:$mathematics\nScience:$science";
}
void save(){
//Inserts Student with all the properties to the local database.
}
void delete(){
//Delete a student from the local database.
}
double calculateScore(){
//Calculates score based on the marks.
}
bool didStudentPass(){
//Based on the marks the student got, this is determined.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment