تم الحل ✓
categoryهندسة الحاسبات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Exercise 1:
1. Use the following UML class diagram to create Java classes:
Person
name: String
+Person()
+Person(String)
+setName(String): void
+getName(): String
+display(): void
+hasSameName(Person); boolean
student ID: int
Student
+Student(String, int)
+Student()
+setID(int) void
+getID(): int
+display(): void
+isEqual(Student); boolean
Note that:
Employee
salary: double
+Employee(String, double)
+setSalary(double) : void
+getSalary: double
+displayO: void
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. Read from file information about 10 Students and from another file information about 10
Employees (Hint: use arrays of 20 objects)
b. Write code to check if there is a duplicate records of students and print them out
C. Write code to check if there is a student and employee who have the same name and print
them out.
d. Write code to print out the 3 employee with the highest salary
Example input files
Students file:
Saeid 312
Mohammed 124
Salem 751
Nasser 613
Saeed 312
Mohammad 813
Mariam 543
Shamma 712
Naser 784
Salim 751
Example input files
Students file:
Mansoor 12300
Mohammed 11000
Zayed 7500
Nasser 6900
Saeed 8000
Maryam 8100
Fatema 15000
Asma 7100
Khaled 12800
Khalifah 9600
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.