تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-14
السؤال
Transcribed Image Text:
1. Use the following UML class diagram to create Java classes:
Student
student ID: int
+Student()
+Student(String, int)
+setID(int): void
+getID(): int
+display(): void
+isEqual(Student): boolean
name: String
+Person()
+Person(String)
Person
+setName(String): void
+getName(): String
+display(): void
+hasSameName(Person); boolean
Employee
salary: double
+Employee(String, double)
+setSalary(double): void
+getSalary(): double
+display(): void
Note that:
a. Method display() in Person prints out the name of the person.
b. Method display() in Student prints out the name and the ID of the student.
c. Method display() in Employee prints out the name and the salary of the employee.
d. Method has SameName(Person) compares the names.
e. Method isEqual(Student) compares the names and ID. It should use the method
hasSameName(Person).
2. Create a Java program to do the following:
a. Create an array of 10 persons
b. Let the user enter data about 10 persons with information related to whether they are
students, employees or just persons.
c. Check if there is a duplicate records of students
d. Check if there is a student and employee who have the same name.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.