Write a console app that declares two classes Employee (base) and (10)
Receptionist (derived).
• Include within Employee class private members: emp_name, emp_lastname,
emp_id,emp_physicaladdress and overridable public member Allowance()
which returns total amount of allowance for each employee which is a sum of
R2500 for house per month, R1000 for car per month.
• Allowance() takes three arguments which is houseAllowance, carAllowance
and allowanceTotal.
• Include in Receptionist class private members: rec_workinghours, rec_salary,
constant clothingAllowance and public member Allowance() which returns
allowance specifically for the receptionist.
• Receptionist has additional allowance of clothing which is R500 per month
• Derive Receptionist class from Employee class.
• Display respective details about one employee and one receptionist refer to
the table:
Employee Receptionist
emp_name Given Mahlatse
emp_l.name Romeo Remeo
emp_id 11111 22222
emp_p.address 207 Ext 5 203 Ext 5
Emp_allowance 3500 4000
rec_w.hours 8
rec_salary 20000
What I have tried:
Module Module1
Sub Main()
Console.WriteLine("Enter employee name: ")
Dim emp_name As String = (Console.ReadLine())
Dim Em = New Employee()
Em.emp_name = emp_name
Console.WriteLine("Enter employee Last Name:")
Dim emp_LastName As String = (Console.ReadLine())
Em.emp_lastname = emp_LastName
Console.WriteLine("Enter employee ID: ")
Dim emp_ID As Integer = (Console.ReadLine())
Em.emp_ID = emp_ID
Console.WriteLine("Enter your phisical adress:")
Dim emp_Address As String = (Console.ReadLine())
Em.emp_physicaladdress = emp_Address
Console.WriteLine("Enter employee Allowance total: ")
Dim emp_Allowance As Integer = (Console.ReadLine())
Em.Emp_allowance = emp_Allowance
Console.WriteLine("Enter Receptionist Name: ")
Dim Rec_Name As String = (Console.ReadLine())
Em.rec_name = Rec_Name
Console.WriteLine("Enter Receptionist Surname: ")
Dim Rec_surname As String = (Console.ReadLine())
Em.rec_Surname = Rec_surname
Console.WriteLine("Enter Receptionist ID: ")
Dim Rec_ID As Integer = (Console.ReadLine())
Em.rec_ID = Rec_ID
Console.WriteLine("Enter Receptionist physical adress: ")
Dim rec_Adress As String = (Console.ReadLine())
Em.rec_address = rec_Adress
Console.WriteLine("Enter receptionist Allowance total")
Dim rec_allowance As Integer = Convert.ToInt32(Console.ReadLine())
Em.rec_allowance = rec_allowance
Dim hour, salary As Integer
hour = 8
salary = 2000
Console.WriteLine(" " + "Employee" + " " + "Receptionist")
Console.WriteLine("emp_name" + " " + emp_name + " " + Rec_Name)
Console.WriteLine("emp_l.name" + " " + emp_LastName + " " + Rec_surname)
Console.WriteLine("emp_id" + " " + Convert.ToString(emp_ID) + " " + Convert.ToString(Rec_ID))
Console.WriteLine("emp_p.adress" + " " + emp_Address + " " + rec_Adress)
Console.WriteLine("emp_allowance" + " " + Convert.ToString(emp_Allowance) + " " + Convert.ToString(rec_allowance))
Console.WriteLine("emp_W.hours" + " " + Convert.ToString(hour))
Console.WriteLine("salary" + " " + Convert.ToString(salary))
Console.ReadLine()
End
End Sub
End Module