تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
2 Create 4 classes Person, Staff, TemporaryStaff and a Main class to test. Here Person class will be inherited by Staff class and Staff class will be again inherited by the TemporaryStaff
class.
In class Person, create the following data members and methods
1. name as String
2. Constructor, Getters, Setters and method to display name
In class Staff, create the following data members and methods
1. staffid as Integer
2. Constructor, Getters, Setters and method to display staffid
In class Temporary Staff, create the following data members and methods
1. days and hoursworked as integer
2. Constructor, Getters, Setters, a method to calculate salary and a method to display days, hours worked and salary.
Write a main class to test the above class. Refer to sample input and output for exact requirements.
Note: Salary per hour is fixed as Rs.50
Input Format
Name of the person
Staff ID
No of days worked
No of hours worked per day
Output Format
Display the staff details along with Salary as shown in the sample output
Sample Testcases
Testcase 1 Input
Ram
1001
10
8
Testcase 1 Output
Name : Ran
Staff Id: 1001
No. of Days 10
No. of Hours Worked : 8
Total Salary: 4000
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.