Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Payroll Classes - Inheritance Can someone please write it out in Swift Playgrond, much appreciated! Payroll Classes -Inheritance Specification: ABC Corp. has a staff of
Payroll Classes - Inheritance
Can someone please write it out in Swift Playgrond, much appreciated!
Payroll Classes -Inheritance Specification: ABC Corp. has a staff of employees and needs to calculate pay for all of its employees. Below is a class hierarchy of the employees StaffMember Volunteer Emplovee Executive Hourly Class Name: StaffMember-super class Members in the Staff Member class: Stored property Data type Purpose Strin Strin Staff member's name Staff member's email name emailAddress Initializer init- no parameter Init-with parameter Purpose Default init to give default value to stored init to assign value to stored ties Method Name calcPay Return t Double Parameter list No parameters Calculate weekl No parameters Return (name)tt$ (calcPay))" -return 0 displayStaffMember String Class Name: Volunteer- sub class of StaffMember Members in the Volunteer class: Stored property Data type Purpose Int hours Volunteer's hours Initializer init- no parameter Init-with parameter se Default init to give default value to stored init to assign value to stored ties Method Name Return type Parameter list Double calcPay No parameters Return 0 No parameters Return "Volunteer tt"+super.displayStaffMember() displayStaffMember String Class Name: Employee - subclass of StaffMember Members in the E class Data type Double Stored prope Purpose Employee's base pay amount or Hourl rate Initializer init- no parameter Init-with parameter Purpose Default init to give default value to stored init to assign value to stored es Method Name calcPay Return Parameter list No parameters Return O Double Class Name: Executive subclass of Employee Members in the Executive class: Stored pro netProfit Data type Purpose Double Net profit for the week Initializer init- no parameter Purpose Default init to give default value to stored init to assign value to stored Init- with parameter Method Name calcPay Return Parameter list No parameters Return base pay+bonus for that week Bonus calculation If net profit is greater than 30,000 Double bonus is 3% of the net profit Else if net profit is between 5,000 to 30,000 bonus is 1% of the net profit Else (the net profit is less than 5,000) there is no bonus No parameters Return "Executivelttsuper.displayStaffMembe displayStaffMember String Class Name: Hourly-subclass of Employee Members in the Hourly class: Stored prope hoursWorke d Data type Double Purpose Hours worked for the week Initializer Purpose init-no parameter Default init to give default value to stored nit to assign value to stored rties Init-with parameter Method Name Return Parameter list No parameters Calculate weekly pay including overtime pay Overtime pay calculation If hours worked are over 40, the overtime pay will be calculated using hourly rate overtime hours 1.5 No parameters Return "HourlyEmp tt"+super.displayStaffMembe calcPay Double displayStaffMember String Function in the program: Function Name Return T Parameter List (staffs:[StaffMember]) Return total weekly pay for all employees calcTotalPay Double Assignment Instructions: 1. Create an Xcode macOS, Command-line Tool project and name it Assignment2_Firstinitial_LastName Type all your code inside of the main.swift file To test your code, create an array of objects containing 3 instances. Summarize your data to display each drink infor mation, the drink with the most sales, the drink with the least sales, and total sales for all drinks. Here is the test data Volunteer: John Smith, emailAddres s: johnsmi th@abc.com hour: 1e Executive: Mary Jones, emailAddres s:maryjones@abc.com net Profit:10980e, payRate:3009 Hourly sh Miller,emailAddress:joshmiller@abe.com hoursworked :45, payRate:25. You can create extra function to enhance your program Name your variables clearly Add comments to document your project and code Add space/indentation to make your code easier to read Submit your main.swift file and a screen shot of your output in Canvas for grading 2. 3. 4. 5. 6. 7. 8. Program Output Employee type Employee name Weekly pay Volunteer Executive HourlyEmp Total payroll for the week:$7187.5 John Smith Mary Jones $6000.0 osh Miller $1187.5 0.0 Program ended with exit code: 0 Payroll Classes -Inheritance Specification: ABC Corp. has a staff of employees and needs to calculate pay for all of its employees. Below is a class hierarchy of the employees StaffMember Volunteer Emplovee Executive Hourly Class Name: StaffMember-super class Members in the Staff Member class: Stored property Data type Purpose Strin Strin Staff member's name Staff member's email name emailAddress Initializer init- no parameter Init-with parameter Purpose Default init to give default value to stored init to assign value to stored ties Method Name calcPay Return t Double Parameter list No parameters Calculate weekl No parameters Return (name)tt$ (calcPay))" -return 0 displayStaffMember String Class Name: Volunteer- sub class of StaffMember Members in the Volunteer class: Stored property Data type Purpose Int hours Volunteer's hours Initializer init- no parameter Init-with parameter se Default init to give default value to stored init to assign value to stored ties Method Name Return type Parameter list Double calcPay No parameters Return 0 No parameters Return "Volunteer tt"+super.displayStaffMember() displayStaffMember String Class Name: Employee - subclass of StaffMember Members in the E class Data type Double Stored prope Purpose Employee's base pay amount or Hourl rate Initializer init- no parameter Init-with parameter Purpose Default init to give default value to stored init to assign value to stored es Method Name calcPay Return Parameter list No parameters Return O Double Class Name: Executive subclass of Employee Members in the Executive class: Stored pro netProfit Data type Purpose Double Net profit for the week Initializer init- no parameter Purpose Default init to give default value to stored init to assign value to stored Init- with parameter Method Name calcPay Return Parameter list No parameters Return base pay+bonus for that week Bonus calculation If net profit is greater than 30,000 Double bonus is 3% of the net profit Else if net profit is between 5,000 to 30,000 bonus is 1% of the net profit Else (the net profit is less than 5,000) there is no bonus No parameters Return "Executivelttsuper.displayStaffMembe displayStaffMember String Class Name: Hourly-subclass of Employee Members in the Hourly class: Stored prope hoursWorke d Data type Double Purpose Hours worked for the week Initializer Purpose init-no parameter Default init to give default value to stored nit to assign value to stored rties Init-with parameter Method Name Return Parameter list No parameters Calculate weekly pay including overtime pay Overtime pay calculation If hours worked are over 40, the overtime pay will be calculated using hourly rate overtime hours 1.5 No parameters Return "HourlyEmp tt"+super.displayStaffMembe calcPay Double displayStaffMember String Function in the program: Function Name Return T Parameter List (staffs:[StaffMember]) Return total weekly pay for all employees calcTotalPay Double Assignment Instructions: 1. Create an Xcode macOS, Command-line Tool project and name it Assignment2_Firstinitial_LastName Type all your code inside of the main.swift file To test your code, create an array of objects containing 3 instances. Summarize your data to display each drink infor mation, the drink with the most sales, the drink with the least sales, and total sales for all drinks. Here is the test data Volunteer: John Smith, emailAddres s: johnsmi th@abc.com hour: 1e Executive: Mary Jones, emailAddres s:maryjones@abc.com net Profit:10980e, payRate:3009 Hourly sh Miller,emailAddress:joshmiller@abe.com hoursworked :45, payRate:25. You can create extra function to enhance your program Name your variables clearly Add comments to document your project and code Add space/indentation to make your code easier to read Submit your main.swift file and a screen shot of your output in Canvas for grading 2. 3. 4. 5. 6. 7. 8. Program Output Employee type Employee name Weekly pay Volunteer Executive HourlyEmp Total payroll for the week:$7187.5 John Smith Mary Jones $6000.0 osh Miller $1187.5 0.0 Program ended with exit code: 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started