Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following FitnessTrainer, PersonalTrainer and GroupTrainer classes public class Fitness Trainer { protected String nane; protected int experience; protected boolean certified; //true has
Given the following FitnessTrainer, PersonalTrainer and GroupTrainer classes " public class Fitness Trainer { protected String nane; protected int experience; protected boolean certified; //true has trainer qualification //false no qualification protected double basicSalary: /ormal constructor //accessor methods //toString method } public class PersonalTrainer extends Fitness Trainer { private String workplace; //either gym or home private int hourshork; /umber of daily working hours / ormal constructor /accessor methods // tostring() method public double calculateIncentive () ; public class GroupIzainer extends Fitness Trainer private String workschedule; //either weekdays or weekend private String activity: // yoga, aerobics, zumba, etc normal constructor /acceseor methode X/Eestring() method Potograph Styles For processor method namned calculateIncentive(); it calculates the incentive of a personal trainer based on the hours worked. If the daily working hours is more than 8 hours, the incentive is RM50 for each additional working hour. Otherwise, there will be no incentive b) Write an application program that perform the following tasks: i Decare an array named personal to store personal trainers' information and another array named group to store group trainers' information where the number of arrays is determined by the user Read all attributes for both subclasses into array II. Calculate and display the incentive earned by each personal trainer whose workplace is at the gym I Given the following FitnessTrainer, PersonalTrainer and GroupTrainer classes public class FitnessTrainer { protected String name; protected int experience; protected boolean certified; //true - has trainer qualification //false - no qualification protected double basicSalary; /ormal constructor 7/accessor methods //toString method public class PersonalTrainer extends FitnessTrainer private String workplace: either gym or home private int hoursWork; /umber of daily working hours // normal constructor //accessor methods /tostring() method public double calculateIncentive(); public class GroupTrainer extends Fitness Trainer private String workchedule; weither weekdays or weekend private String activity: Vy yoga, aerobics, zumba, etc normal conatructor y access or methods Stostring method Paragraph Styles For processor method named calculateIncentive(); it calculates the incentive of a personal trainer based on the hours worked. If the daily working hours is more than 8 hours, the incentive is RM50 for each additional working hour. Otherwise, there will be no incentive b) Write an application program that perform the following tasks: i. Declare an array named personal to store personal trainers' information and another array named group to store group trainers' information where the number of arrays is determined by the user. ii. Read all attributes for both subclasses into array iii . Calculate and display the incentive earned by each personal trainer whose workplace is at the gym
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