Untitled
unknown
java
a year ago
2.0 kB
35
Indexable
Never
package student.task; public class MgmtAppTask { public static void main(String[] args) { StudentDatabase database = new StudentDatabase(); // Demonstrate adding, updating, and listing students Student student1 = new Student("Alice", 20, "Computer Science"); Student student2 = new Student("Bob", 21, "Engineering"); database.addStudent(student1); database.addStudent(student2); Student retrievedStudent = database.getStudent(1); retrievedStudent.setName("Alex"); database.updateStudent(retrievedStudent); database.listStudents(); database.deleteStudent(1); database.listStudents(); } } class StudentDatabase { public void addStudent(Student student) { } public Student getStudent(int i) { return null; } public void updateStudent(Student retrievedStudent) { } public void listStudents() { // should be in readable form for humans :) } public void deleteStudent(int i) { } // Implement methods: addStudent, getStudent, updateStudent, deleteStudent, listStudents } class Student { private int id; private String name; private int age; private String course; public Student(String name, int age, String course) { this.name = name; this.age = age; this.course = course; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } }