-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentFiles_1Perrott.java
36 lines (32 loc) · 1.13 KB
/
StudentFiles_1Perrott.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
public class StudentFiles_1Perrott {
public static void main(String[] args) {
Student alpha = new Student();
alpha.initialize("Zee", 2042, "Martian College Prep");
System.out.println(alpha.toString());
alpha.changeSchool("Bellarmine College Prep");
System.out.println("An Update To Zee's Profile Has Been Made:\n");
System.out.println(alpha.toString());
Student beta = new Student();
beta.initialize("Sally Reese", 1984, "Orwell College");
System.out.println(beta.toString());
Student gamma = new Student();
gamma.initialize("Bobby Jefferson", 2022, "Grants Pass High School");
System.out.println(gamma.toString());
}
}
class Student {
private String name;
private int year;
private String school;
public void initialize(String nomen, int annus, String scola) {
name = nomen;
year = annus;
school = scola;
}
public String toString() {
return (name + " is a member of the class of " + year + " at " + school + ".\n");
}
public void changeSchool(String scola) {
school = scola;
}
}