Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needs to be in Java! 1. With the class Person, you areto extend a subclass named, PaidAdvisor whose variables, regularPayRate, specialPayRate, overtimePayRate, and hoursWorked should

Needs to be in Java!

1. With the class Person, you areto extend a subclass named, PaidAdvisor whose variables, regularPayRate, specialPayRate, overtimePayRate, and hoursWorked should be defined before their being used in the methods. (a) Build a subclass, PaidAdvisor besides Person. (b)regularPayRate is 25 dollars per an hour. (c) specialPayRate is 50 dollars per an hour and is calculated separately (d) overtimePayRate is one and half time of the regular pay rate (e) Whenever the worker works more than 30 hours, the overtime pay rate kicks in and the pay is calculated accordingly. However, special work hours are separately calculated. Say, you have worked 40 hours. Your system must be able to ask a separate question like, "Have you worked for a special session?" If so (say your special session hours are 5), you need to subtract the special hours from the total hours (35 total hours and 5 special session hours) Calculate the pay accordingly (maybe you can add a variable like hoursSpecial?) (f) Define the constructors that sets regularPayRate/specialPayRate/ oveztinePayRate and hoursRegular/hoursspeciai and 0 or the set values (e g., rate or hours) (8) Define the method, tostring0, that returns the wages based on the method, calculatePay (h) Define the method, calculaePay , that calculates the multiplication of the pay rate (the regular pay rate and the overtime pay rate and the hours worked (i) Define the method, get FayRate that returns either of the pay rates (regular or overtime)

image text in transcribed

0) Define the method, getHoursWor ked (0, that returns the hours worked. (k) Define the method, set NameRateHours , that sets the name, rate and hours for the research consoltant. (1) After building all the parts as above, then build a program that asks the user to enter the hours and calculates the pay as the test program. Use the class Person below. public class Person private String firsthame: //store the first name private String lastName: //store the 1ast nane public Persont) //Default constructor firstiamei //constructor vith parameters public Person(String first, String last) setNane (first, last): //Method to output the firet name and last name public String tostring) return (firstName lastNane) : / /Met.hod to set firstNane and lastNane public void setName(String first, String last) firstiane first: lastName = last; / /Method to return the firstvame. public String getPirstNamet) return firsthame; //Method to return the lastName public String getlastNane0) return lastiane

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

Persuading Your Audience Strategies for

Answered: 1 week ago